Merge from Chromium at DEPS revision 225410
This commit was generated by merge_to_master.py.
Change-Id: I639f21f936f7475217030840a808765c32e44635
diff --git a/Source/core/dom/Attr.cpp b/Source/core/dom/Attr.cpp
index 440ca96..8ebced8 100644
--- a/Source/core/dom/Attr.cpp
+++ b/Source/core/dom/Attr.cpp
@@ -29,7 +29,7 @@
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/dom/Element.h"
#include "core/dom/ExceptionCode.h"
-#include "core/dom/ScopedEventQueue.h"
+#include "core/events/ScopedEventQueue.h"
#include "core/dom/Text.h"
#include "wtf/text/AtomicString.h"
#include "wtf/text/StringBuilder.h"
@@ -103,7 +103,7 @@
return;
}
- if (static_cast<Attr*>(this)->qualifiedName() == xmlnsAtom) {
+ if (this->qualifiedName() == xmlnsAtom) {
es.throwDOMException(NamespaceError, ExceptionMessages::failedToSet("prefix", "Attr", "The prefix '" + prefix + "' may not be used as a namespace prefix for attributes whose qualified name is '" + xmlnsAtom + "'."));
return;
}
diff --git a/Source/core/dom/AutocompleteErrorEvent.h b/Source/core/dom/AutocompleteErrorEvent.h
deleted file mode 100644
index 2f36cc7..0000000
--- a/Source/core/dom/AutocompleteErrorEvent.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 AutocompleteErrorEvent_h
-#define AutocompleteErrorEvent_h
-
-#include "core/dom/Event.h"
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-struct AutocompleteErrorEventInit : public EventInit {
- String reason;
-};
-
-class AutocompleteErrorEvent : public Event {
-public:
- static PassRefPtr<AutocompleteErrorEvent> create()
- {
- return adoptRef(new AutocompleteErrorEvent);
- }
-
- static PassRefPtr<AutocompleteErrorEvent> create(const String& reason)
- {
- return adoptRef(new AutocompleteErrorEvent(reason));
- }
-
- static PassRefPtr<AutocompleteErrorEvent> create(const AtomicString& eventType, const AutocompleteErrorEventInit& initializer)
- {
- return adoptRef(new AutocompleteErrorEvent(eventType, initializer));
- }
-
- const String& reason() const { return m_reason; }
-
- virtual const AtomicString& interfaceName() const { return eventNames().interfaceForAutocompleteErrorEvent; }
-
-private:
- AutocompleteErrorEvent()
- {
- ScriptWrappable::init(this);
- }
-
- AutocompleteErrorEvent(const String& reason)
- : Event(eventNames().autocompleteerrorEvent, false, false)
- , m_reason(reason)
- {
- ScriptWrappable::init(this);
- }
-
- AutocompleteErrorEvent(const AtomicString& eventType, const AutocompleteErrorEventInit& initializer)
- : Event(eventType, initializer)
- , m_reason(initializer.reason)
- {
- ScriptWrappable::init(this);
- }
-
- String m_reason;
-};
-
-} // namespace WebCore
-
-#endif // AutocompleteErrorEvent_h
diff --git a/Source/core/dom/AutocompleteErrorEvent.idl b/Source/core/dom/AutocompleteErrorEvent.idl
deleted file mode 100644
index 5f9b700..0000000
--- a/Source/core/dom/AutocompleteErrorEvent.idl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
- */
-
-[
- ConstructorTemplate=Event
-] interface AutocompleteErrorEvent : Event {
- [InitializedByEventConstructor] readonly attribute DOMString reason;
-};
-
diff --git a/Source/core/dom/BeforeLoadEvent.h b/Source/core/dom/BeforeLoadEvent.h
deleted file mode 100644
index 1e6d5fc..0000000
--- a/Source/core/dom/BeforeLoadEvent.h
+++ /dev/null
@@ -1,89 +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, 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 BeforeLoadEvent_h
-#define BeforeLoadEvent_h
-
-#include "core/dom/Event.h"
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-struct BeforeLoadEventInit : public EventInit {
- BeforeLoadEventInit()
- {
- };
-
- String url;
-};
-
-class BeforeLoadEvent : public Event {
-public:
- static PassRefPtr<BeforeLoadEvent> create()
- {
- return adoptRef(new BeforeLoadEvent);
- }
-
- static PassRefPtr<BeforeLoadEvent> create(const String& url)
- {
- return adoptRef(new BeforeLoadEvent(url));
- }
-
- static PassRefPtr<BeforeLoadEvent> create(const AtomicString& type, const BeforeLoadEventInit& initializer)
- {
- return adoptRef(new BeforeLoadEvent(type, initializer));
- }
-
- const String& url() const { return m_url; }
-
- virtual const AtomicString& interfaceName() const { return eventNames().interfaceForBeforeLoadEvent; }
-
-private:
- BeforeLoadEvent()
- {
- ScriptWrappable::init(this);
- }
-
- explicit BeforeLoadEvent(const String& url)
- : Event(eventNames().beforeloadEvent, false, true)
- , m_url(url)
- {
- ScriptWrappable::init(this);
- }
-
- BeforeLoadEvent(const AtomicString& type, const BeforeLoadEventInit& initializer)
- : Event(type, initializer)
- , m_url(initializer.url)
- {
- ScriptWrappable::init(this);
- }
-
- String m_url;
-};
-
-} // namespace WebCore
-
-#endif // BeforeLoadEvent_h
diff --git a/Source/core/dom/BeforeLoadEvent.idl b/Source/core/dom/BeforeLoadEvent.idl
deleted file mode 100644
index 428a513..0000000
--- a/Source/core/dom/BeforeLoadEvent.idl
+++ /dev/null
@@ -1,32 +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, 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.
- *
- */
-
-[
- ConstructorTemplate=Event
-] interface BeforeLoadEvent : Event {
- [InitializedByEventConstructor] readonly attribute DOMString url;
-};
-
diff --git a/Source/core/dom/BeforeTextInsertedEvent.cpp b/Source/core/dom/BeforeTextInsertedEvent.cpp
deleted file mode 100644
index 72e4780..0000000
--- a/Source/core/dom/BeforeTextInsertedEvent.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, 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 "core/dom/BeforeTextInsertedEvent.h"
-
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-BeforeTextInsertedEvent::BeforeTextInsertedEvent(const String& text)
- : Event(eventNames().webkitBeforeTextInsertedEvent, false, true), m_text(text)
-{
-}
-
-BeforeTextInsertedEvent::~BeforeTextInsertedEvent()
-{
-}
-
-const AtomicString& BeforeTextInsertedEvent::interfaceName() const
-{
- // Notice that there is no BeforeTextInsertedEvent.idl.
- return eventNames().interfaceForEvent;
-}
-
-}
diff --git a/Source/core/dom/BeforeTextInsertedEvent.h b/Source/core/dom/BeforeTextInsertedEvent.h
deleted file mode 100644
index a08e2de..0000000
--- a/Source/core/dom/BeforeTextInsertedEvent.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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 BeforeTextInsertedEvent_h
-#define BeforeTextInsertedEvent_h
-
-#include "core/dom/Event.h"
-
-namespace WebCore {
-
-class BeforeTextInsertedEvent : public Event {
-public:
- virtual ~BeforeTextInsertedEvent();
-
- static PassRefPtr<BeforeTextInsertedEvent> create(const String& text)
- {
- return adoptRef(new BeforeTextInsertedEvent(text));
- }
-
- virtual const AtomicString& interfaceName() const;
- virtual bool isBeforeTextInsertedEvent() const { return true; }
-
- const String& text() const { return m_text; }
- void setText(const String& s) { m_text = s; }
-
-private:
- explicit BeforeTextInsertedEvent(const String&);
-
- String m_text;
-};
-
-} // namespace
-
-#endif
diff --git a/Source/core/dom/BeforeUnloadEvent.cpp b/Source/core/dom/BeforeUnloadEvent.cpp
deleted file mode 100644
index a22374c..0000000
--- a/Source/core/dom/BeforeUnloadEvent.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.
- * Copyright (C) 2013 Samsung Electronics.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/BeforeUnloadEvent.h"
-
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-BeforeUnloadEvent::BeforeUnloadEvent()
- : Event(eventNames().beforeunloadEvent, false, true)
-{
- ScriptWrappable::init(this);
-}
-
-BeforeUnloadEvent::~BeforeUnloadEvent()
-{
-}
-
-bool BeforeUnloadEvent::isBeforeUnloadEvent() const
-{
- return true;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/BeforeUnloadEvent.h b/Source/core/dom/BeforeUnloadEvent.h
deleted file mode 100644
index a76ad52..0000000
--- a/Source/core/dom/BeforeUnloadEvent.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
- * Copyright (C) 2013 Samsung Electronics.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef BeforeUnloadEvent_h
-#define BeforeUnloadEvent_h
-
-#include "core/dom/Event.h"
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-class BeforeUnloadEvent : public Event {
-public:
- virtual ~BeforeUnloadEvent();
-
- static PassRefPtr<BeforeUnloadEvent> create()
- {
- return adoptRef(new BeforeUnloadEvent);
- }
-
- virtual bool isBeforeUnloadEvent() const OVERRIDE;
-
- void setReturnValue(const String& returnValue) { m_returnValue = returnValue; }
- String returnValue() const { return m_returnValue; }
-
- virtual const AtomicString& interfaceName() const OVERRIDE { return eventNames().interfaceForBeforeUnloadEvent; }
-
-private:
- BeforeUnloadEvent();
-
- String m_returnValue;
-};
-
-inline BeforeUnloadEvent* toBeforeUnloadEvent(Event* event)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(!event || event->isBeforeUnloadEvent());
- return static_cast<BeforeUnloadEvent*>(event);
-}
-
-} // namespace WebCore
-
-#endif // BeforeUnloadEvent_h
diff --git a/Source/core/dom/BeforeUnloadEvent.idl b/Source/core/dom/BeforeUnloadEvent.idl
deleted file mode 100644
index 618d558..0000000
--- a/Source/core/dom/BeforeUnloadEvent.idl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2013 Samsung Electronics. 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.
- */
-
-interface BeforeUnloadEvent : Event {
- attribute DOMString returnValue;
-};
diff --git a/Source/core/dom/CharacterData.cpp b/Source/core/dom/CharacterData.cpp
index 9d6f9c7..7cc21d1 100644
--- a/Source/core/dom/CharacterData.cpp
+++ b/Source/core/dom/CharacterData.cpp
@@ -25,9 +25,9 @@
#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "core/dom/Document.h"
-#include "core/dom/EventNames.h"
+#include "core/events/EventNames.h"
#include "core/dom/ExceptionCode.h"
-#include "core/dom/MutationEvent.h"
+#include "core/events/MutationEvent.h"
#include "core/dom/MutationObserverInterestGroup.h"
#include "core/dom/MutationRecord.h"
#include "core/dom/ProcessingInstruction.h"
diff --git a/Source/core/dom/CheckedRadioButtons.cpp b/Source/core/dom/CheckedRadioButtons.cpp
deleted file mode 100644
index 0dc3b4d..0000000
--- a/Source/core/dom/CheckedRadioButtons.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2009 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "core/dom/CheckedRadioButtons.h"
-
-#include "core/html/HTMLInputElement.h"
-#include "wtf/HashSet.h"
-
-namespace WebCore {
-
-class RadioButtonGroup {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- static PassOwnPtr<RadioButtonGroup> create();
- bool isEmpty() const { return m_members.isEmpty(); }
- bool isRequired() const { return m_requiredCount; }
- HTMLInputElement* checkedButton() const { return m_checkedButton; }
- void add(HTMLInputElement*);
- void updateCheckedState(HTMLInputElement*);
- void requiredAttributeChanged(HTMLInputElement*);
- void remove(HTMLInputElement*);
- bool contains(HTMLInputElement*) const;
-
-private:
- RadioButtonGroup();
- void setNeedsValidityCheckForAllButtons();
- bool isValid() const;
- void setCheckedButton(HTMLInputElement*);
-
- HashSet<HTMLInputElement*> m_members;
- HTMLInputElement* m_checkedButton;
- size_t m_requiredCount;
-};
-
-RadioButtonGroup::RadioButtonGroup()
- : m_checkedButton(0)
- , m_requiredCount(0)
-{
-}
-
-PassOwnPtr<RadioButtonGroup> RadioButtonGroup::create()
-{
- return adoptPtr(new RadioButtonGroup);
-}
-
-inline bool RadioButtonGroup::isValid() const
-{
- return !isRequired() || m_checkedButton;
-}
-
-void RadioButtonGroup::setCheckedButton(HTMLInputElement* button)
-{
- HTMLInputElement* oldCheckedButton = m_checkedButton;
- if (oldCheckedButton == button)
- return;
- m_checkedButton = button;
- if (oldCheckedButton)
- oldCheckedButton->setChecked(false);
-}
-
-void RadioButtonGroup::add(HTMLInputElement* button)
-{
- ASSERT(button->isRadioButton());
- if (!m_members.add(button).isNewEntry)
- return;
- bool groupWasValid = isValid();
- if (button->isRequired())
- ++m_requiredCount;
- if (button->checked())
- setCheckedButton(button);
-
- bool groupIsValid = isValid();
- if (groupWasValid != groupIsValid)
- setNeedsValidityCheckForAllButtons();
- else if (!groupIsValid) {
- // A radio button not in a group is always valid. We need to make it
- // invalid only if the group is invalid.
- button->setNeedsValidityCheck();
- }
-}
-
-void RadioButtonGroup::updateCheckedState(HTMLInputElement* button)
-{
- ASSERT(button->isRadioButton());
- ASSERT(m_members.contains(button));
- bool wasValid = isValid();
- if (button->checked())
- setCheckedButton(button);
- else {
- if (m_checkedButton == button)
- m_checkedButton = 0;
- }
- if (wasValid != isValid())
- setNeedsValidityCheckForAllButtons();
-}
-
-void RadioButtonGroup::requiredAttributeChanged(HTMLInputElement* button)
-{
- ASSERT(button->isRadioButton());
- ASSERT(m_members.contains(button));
- bool wasValid = isValid();
- if (button->isRequired())
- ++m_requiredCount;
- else {
- ASSERT(m_requiredCount);
- --m_requiredCount;
- }
- if (wasValid != isValid())
- setNeedsValidityCheckForAllButtons();
-}
-
-void RadioButtonGroup::remove(HTMLInputElement* button)
-{
- ASSERT(button->isRadioButton());
- HashSet<HTMLInputElement*>::iterator it = m_members.find(button);
- if (it == m_members.end())
- return;
- bool wasValid = isValid();
- m_members.remove(it);
- if (button->isRequired()) {
- ASSERT(m_requiredCount);
- --m_requiredCount;
- }
- if (m_checkedButton == button)
- m_checkedButton = 0;
-
- if (m_members.isEmpty()) {
- ASSERT(!m_requiredCount);
- ASSERT(!m_checkedButton);
- } else if (wasValid != isValid())
- setNeedsValidityCheckForAllButtons();
- if (!wasValid) {
- // A radio button not in a group is always valid. We need to make it
- // valid only if the group was invalid.
- button->setNeedsValidityCheck();
- }
-}
-
-void RadioButtonGroup::setNeedsValidityCheckForAllButtons()
-{
- typedef HashSet<HTMLInputElement*>::const_iterator Iterator;
- Iterator end = m_members.end();
- for (Iterator it = m_members.begin(); it != end; ++it) {
- HTMLInputElement* button = *it;
- ASSERT(button->isRadioButton());
- button->setNeedsValidityCheck();
- }
-}
-
-bool RadioButtonGroup::contains(HTMLInputElement* button) const
-{
- return m_members.contains(button);
-}
-
-// ----------------------------------------------------------------
-
-// Explicity define empty constructor and destructor in order to prevent the
-// compiler from generating them as inlines. So we don't need to to define
-// RadioButtonGroup in the header.
-CheckedRadioButtons::CheckedRadioButtons()
-{
-}
-
-CheckedRadioButtons::~CheckedRadioButtons()
-{
-}
-
-void CheckedRadioButtons::addButton(HTMLInputElement* element)
-{
- ASSERT(element->isRadioButton());
- if (element->name().isEmpty())
- return;
-
- if (!m_nameToGroupMap)
- m_nameToGroupMap = adoptPtr(new NameToGroupMap);
-
- OwnPtr<RadioButtonGroup>& group = m_nameToGroupMap->add(element->name().impl(), PassOwnPtr<RadioButtonGroup>()).iterator->value;
- if (!group)
- group = RadioButtonGroup::create();
- group->add(element);
-}
-
-void CheckedRadioButtons::updateCheckedState(HTMLInputElement* element)
-{
- ASSERT(element->isRadioButton());
- if (element->name().isEmpty())
- return;
- ASSERT(m_nameToGroupMap);
- if (!m_nameToGroupMap)
- return;
- RadioButtonGroup* group = m_nameToGroupMap->get(element->name().impl());
- ASSERT(group);
- group->updateCheckedState(element);
-}
-
-void CheckedRadioButtons::requiredAttributeChanged(HTMLInputElement* element)
-{
- ASSERT(element->isRadioButton());
- if (element->name().isEmpty())
- return;
- ASSERT(m_nameToGroupMap);
- if (!m_nameToGroupMap)
- return;
- RadioButtonGroup* group = m_nameToGroupMap->get(element->name().impl());
- ASSERT(group);
- group->requiredAttributeChanged(element);
-}
-
-HTMLInputElement* CheckedRadioButtons::checkedButtonForGroup(const AtomicString& name) const
-{
- if (!m_nameToGroupMap)
- return 0;
- RadioButtonGroup* group = m_nameToGroupMap->get(name.impl());
- return group ? group->checkedButton() : 0;
-}
-
-bool CheckedRadioButtons::isInRequiredGroup(HTMLInputElement* element) const
-{
- ASSERT(element->isRadioButton());
- if (element->name().isEmpty())
- return false;
- if (!m_nameToGroupMap)
- return false;
- RadioButtonGroup* group = m_nameToGroupMap->get(element->name().impl());
- return group && group->isRequired() && group->contains(element);
-}
-
-void CheckedRadioButtons::removeButton(HTMLInputElement* element)
-{
- ASSERT(element->isRadioButton());
- if (element->name().isEmpty())
- return;
- if (!m_nameToGroupMap)
- return;
-
- NameToGroupMap::iterator it = m_nameToGroupMap->find(element->name().impl());
- if (it == m_nameToGroupMap->end())
- return;
- it->value->remove(element);
- if (it->value->isEmpty()) {
- // FIXME: We may skip deallocating the empty RadioButtonGroup for
- // performance improvement. If we do so, we need to change the key type
- // of m_nameToGroupMap from StringImpl* to AtomicString.
- m_nameToGroupMap->remove(it);
- if (m_nameToGroupMap->isEmpty())
- m_nameToGroupMap.clear();
- }
-}
-
-} // namespace
diff --git a/Source/core/dom/CheckedRadioButtons.h b/Source/core/dom/CheckedRadioButtons.h
deleted file mode 100644
index 6a1585b..0000000
--- a/Source/core/dom/CheckedRadioButtons.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2009 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef CheckedRadioButtons_h
-#define CheckedRadioButtons_h
-
-#include "wtf/Forward.h"
-#include "wtf/HashMap.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/text/StringHash.h"
-
-namespace WebCore {
-
-class HTMLInputElement;
-class RadioButtonGroup;
-
-// FIXME: Rename the class. The class was a simple map from a name to a checked
-// radio button. It manages RadioButtonGroup objects now.
-class CheckedRadioButtons {
-public:
- CheckedRadioButtons();
- ~CheckedRadioButtons();
- void addButton(HTMLInputElement*);
- void updateCheckedState(HTMLInputElement*);
- void requiredAttributeChanged(HTMLInputElement*);
- void removeButton(HTMLInputElement*);
- HTMLInputElement* checkedButtonForGroup(const AtomicString& groupName) const;
- bool isInRequiredGroup(HTMLInputElement*) const;
-
-private:
- typedef HashMap<StringImpl*, OwnPtr<RadioButtonGroup> > NameToGroupMap;
- OwnPtr<NameToGroupMap> m_nameToGroupMap;
-};
-
-} // namespace WebCore
-
-#endif // CheckedRadioButtons_h
diff --git a/Source/core/dom/ClipboardEvent.cpp b/Source/core/dom/ClipboardEvent.cpp
deleted file mode 100644
index bda69f2..0000000
--- a/Source/core/dom/ClipboardEvent.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/ClipboardEvent.h"
-
-#include "core/dom/Clipboard.h"
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-ClipboardEvent::ClipboardEvent()
-{
-}
-
-ClipboardEvent::ClipboardEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<Clipboard> clipboard)
- : Event(eventType, canBubble, cancelable), m_clipboard(clipboard)
-{
-}
-
-ClipboardEvent::~ClipboardEvent()
-{
-}
-
-const AtomicString& ClipboardEvent::interfaceName() const
-{
- // Notice that there is no ClipboardEvent.idl.
- return eventNames().interfaceForEvent;
-}
-
-bool ClipboardEvent::isClipboardEvent() const
-{
- return true;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/ClipboardEvent.h b/Source/core/dom/ClipboardEvent.h
deleted file mode 100644
index 87bd13d..0000000
--- a/Source/core/dom/ClipboardEvent.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ClipboardEvent_h
-#define ClipboardEvent_h
-
-#include "core/dom/Event.h"
-
-namespace WebCore {
-
- class Clipboard;
-
- class ClipboardEvent : public Event {
- public:
- virtual ~ClipboardEvent();
-
- static PassRefPtr<ClipboardEvent> create()
- {
- return adoptRef(new ClipboardEvent);
- }
- static PassRefPtr<ClipboardEvent> create(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtr<Clipboard> clipboardArg)
- {
- return adoptRef(new ClipboardEvent(type, canBubbleArg, cancelableArg, clipboardArg));
- }
-
- Clipboard* clipboard() const { return m_clipboard.get(); }
-
- private:
- ClipboardEvent();
- ClipboardEvent(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtr<Clipboard>);
-
- virtual const AtomicString& interfaceName() const OVERRIDE;
- virtual bool isClipboardEvent() const OVERRIDE;
-
- RefPtr<Clipboard> m_clipboard;
- };
-
-} // namespace WebCore
-
-#endif // ClipboardEvent_h
diff --git a/Source/core/dom/CompositionEvent.cpp b/Source/core/dom/CompositionEvent.cpp
deleted file mode 100644
index 45c61c0..0000000
--- a/Source/core/dom/CompositionEvent.cpp
+++ /dev/null
@@ -1,76 +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 "core/dom/CompositionEvent.h"
-
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-CompositionEventInit::CompositionEventInit()
-{
-}
-
-CompositionEvent::CompositionEvent()
-{
- ScriptWrappable::init(this);
-}
-
-CompositionEvent::CompositionEvent(const AtomicString& type, PassRefPtr<AbstractView> view, const String& data)
- : UIEvent(type, true, true, view, 0)
- , m_data(data)
-{
- ScriptWrappable::init(this);
-}
-
-CompositionEvent::CompositionEvent(const AtomicString& type, const CompositionEventInit& initializer)
- : UIEvent(type, initializer)
- , m_data(initializer.data)
-{
- ScriptWrappable::init(this);
-}
-
-CompositionEvent::~CompositionEvent()
-{
-}
-
-void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, const String& data)
-{
- if (dispatched())
- return;
-
- initUIEvent(type, canBubble, cancelable, view, 0);
-
- m_data = data;
-}
-
-const AtomicString& CompositionEvent::interfaceName() const
-{
- return eventNames().interfaceForCompositionEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CompositionEvent.h b/Source/core/dom/CompositionEvent.h
deleted file mode 100644
index cf39f9b..0000000
--- a/Source/core/dom/CompositionEvent.h
+++ /dev/null
@@ -1,75 +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 CompositionEvent_h
-#define CompositionEvent_h
-
-#include "core/dom/UIEvent.h"
-
-namespace WebCore {
-
-struct CompositionEventInit : UIEventInit {
- CompositionEventInit();
-
- String data;
-};
-
-class CompositionEvent : public UIEvent {
-public:
- static PassRefPtr<CompositionEvent> create()
- {
- return adoptRef(new CompositionEvent);
- }
-
- static PassRefPtr<CompositionEvent> create(const AtomicString& type, PassRefPtr<AbstractView> view, const String& data)
- {
- return adoptRef(new CompositionEvent(type, view, data));
- }
-
- static PassRefPtr<CompositionEvent> create(const AtomicString& type, const CompositionEventInit& initializer)
- {
- return adoptRef(new CompositionEvent(type, initializer));
- }
-
- virtual ~CompositionEvent();
-
- void initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, const String& data);
-
- String data() const { return m_data; }
-
- virtual const AtomicString& interfaceName() const;
-
-private:
- CompositionEvent();
- CompositionEvent(const AtomicString& type, PassRefPtr<AbstractView>, const String&);
- CompositionEvent(const AtomicString& type, const CompositionEventInit&);
-
- String m_data;
-};
-
-} // namespace WebCore
-
-#endif // CompositionEvent_h
diff --git a/Source/core/dom/CompositionEvent.idl b/Source/core/dom/CompositionEvent.idl
deleted file mode 100644
index c54d50f..0000000
--- a/Source/core/dom/CompositionEvent.idl
+++ /dev/null
@@ -1,39 +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.
- */
-
-[
- ConstructorTemplate=Event
-] interface CompositionEvent : UIEvent {
-
- [InitializedByEventConstructor] readonly attribute DOMString data;
-
- void initCompositionEvent([Default=Undefined] optional DOMString typeArg,
- [Default=Undefined] optional boolean canBubbleArg,
- [Default=Undefined] optional boolean cancelableArg,
- [Default=Undefined] optional Window viewArg,
- [Default=Undefined] optional DOMString dataArg);
-
-};
-
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index de26f39..dd9f85d 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -28,10 +28,10 @@
#include "core/dom/ChildListMutationScope.h"
#include "core/dom/ContainerNodeAlgorithms.h"
#include "core/dom/ElementTraversal.h"
-#include "core/dom/EventNames.h"
+#include "core/events/EventNames.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/FullscreenElementStack.h"
-#include "core/dom/MutationEvent.h"
+#include "core/events/MutationEvent.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/NodeRenderStyle.h"
#include "core/dom/NodeTraversal.h"
@@ -144,7 +144,7 @@
{
// Not mentioned in spec: throw NotFoundError if newChild is null
if (!newChild) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return false;
}
@@ -153,7 +153,7 @@
ASSERT(!newParent->isDocumentTypeNode());
ASSERT(isChildTypeAllowed(newParent, newChild));
if (containsConsideringHostElements(newChild, newParent)) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return false;
}
return true;
@@ -162,22 +162,22 @@
// This should never happen, but also protect release builds from tree corruption.
ASSERT(!newChild->isPseudoElement());
if (newChild->isPseudoElement()) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return false;
}
if (containsConsideringHostElements(newChild, newParent)) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return false;
}
if (oldChild && newParent->isDocumentNode()) {
if (!toDocument(newParent)->canReplaceChild(newChild, oldChild)) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return false;
}
} else if (!isChildTypeAllowed(newParent, newChild)) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return false;
}
@@ -189,7 +189,7 @@
ASSERT(!newParent->isDocumentTypeNode());
ASSERT(isChildTypeAllowed(newParent, newChild));
if (newChild->contains(newParent)) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return false;
}
@@ -226,7 +226,7 @@
// NotFoundError: Raised if refChild is not a child of this node
if (refChild->parentNode() != this) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -334,7 +334,7 @@
return;
if (!oldChild) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -344,7 +344,7 @@
// NotFoundError: Raised if oldChild is not a child of this node.
if (oldChild->parentNode() != this) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -451,7 +451,7 @@
// NotFoundError: Raised if oldChild is not a child of this node.
if (!oldChild || oldChild->parentNode() != this) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -465,7 +465,7 @@
// Events fired when blurring currently focused node might have moved this
// child into a different parent.
if (child->parentNode() != this) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -473,7 +473,7 @@
// Mutation events might have moved this child into a different parent.
if (child->parentNode() != this) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -553,11 +553,17 @@
// and remove... e.g. stop loading frames, fire unload events.
willRemoveChildren(protect.get());
- // Exclude this node when looking for removed focusedElement since only
- // children will be removed.
- // This must be later than willRemvoeChildren, which might change focus
- // state of a child.
- document().removeFocusedElementOfSubtree(this, true);
+ {
+ // Removing focus can cause frames to load, either via events (focusout, blur)
+ // or widget updates (e.g., for <embed>).
+ SubframeLoadingDisabler disabler(this);
+
+ // Exclude this node when looking for removed focusedElement since only
+ // children will be removed.
+ // This must be later than willRemoveChildren, which might change focus
+ // state of a child.
+ document().removeFocusedElementOfSubtree(this, true);
+ }
NodeVector removedChildren;
{
diff --git a/Source/core/dom/CustomElement.cpp b/Source/core/dom/CustomElement.cpp
index ddb8db2..d09bafc 100644
--- a/Source/core/dom/CustomElement.cpp
+++ b/Source/core/dom/CustomElement.cpp
@@ -64,10 +64,10 @@
{
validNames = NameSet(validNames & enabledNameSet());
- if ((validNames & EmbedderNames) && notFound != embedderCustomElementNames().find(name))
+ if ((validNames & EmbedderNames) && kNotFound != embedderCustomElementNames().find(name))
return Document::isValidName(name);
- if ((validNames & StandardNames) && notFound != name.find('-')) {
+ if ((validNames & StandardNames) && kNotFound != name.find('-')) {
DEFINE_STATIC_LOCAL(Vector<AtomicString>, reservedNames, ());
if (reservedNames.isEmpty()) {
reservedNames.append(MathMLNames::annotation_xmlTag.localName());
@@ -80,7 +80,7 @@
reservedNames.append(SVGNames::missing_glyphTag.localName());
}
- if (notFound == reservedNames.find(name))
+ if (kNotFound == reservedNames.find(name))
return Document::isValidName(name.string());
}
diff --git a/Source/core/dom/CustomElementCallbackDispatcher.cpp b/Source/core/dom/CustomElementCallbackDispatcher.cpp
index 41d5ecf..9ae56c4 100644
--- a/Source/core/dom/CustomElementCallbackDispatcher.cpp
+++ b/Source/core/dom/CustomElementCallbackDispatcher.cpp
@@ -31,7 +31,8 @@
#include "config.h"
#include "core/dom/CustomElementCallbackDispatcher.h"
-#include "core/dom/CustomElementCallbackInvocation.h"
+#include "core/dom/CustomElementCallbackQueue.h"
+#include "core/dom/CustomElementCallbackScheduler.h"
#include "wtf/MainThread.h"
namespace WebCore {
@@ -73,8 +74,7 @@
s_elementQueueEnd = kNumSentinels;
m_flattenedProcessingStack.resize(s_elementQueueEnd);
- ElementCallbackQueueMap emptyMap;
- m_elementCallbackQueueMap.swap(emptyMap);
+ CustomElementCallbackScheduler::clearElementCallbackQueueMap();
bool didWork = start < end;
return didWork;
@@ -107,46 +107,11 @@
m_flattenedProcessingStack.resize(start);
s_elementQueueEnd = start;
- if (start == kNumSentinels) {
- ElementCallbackQueueMap emptyMap;
- m_elementCallbackQueueMap.swap(emptyMap);
- }
+ if (start == kNumSentinels)
+ CustomElementCallbackScheduler::clearElementCallbackQueueMap();
}
-CustomElementCallbackQueue* CustomElementCallbackDispatcher::ensureCallbackQueue(PassRefPtr<Element> element)
-{
- Element* key = element.get();
- ElementCallbackQueueMap::iterator it = m_elementCallbackQueueMap.find(key);
- if (it == m_elementCallbackQueueMap.end())
- it = m_elementCallbackQueueMap.add(key, CustomElementCallbackQueue::create(element)).iterator;
- return it->value.get();
-}
-
-// Finds or creates the callback queue for element. If the
-// createdCallback has not finished running, the callback queue is not
-// moved to the top-of-stack. Otherwise like
-// scheduleInCurrentElementQueue.
-CustomElementCallbackQueue* CustomElementCallbackDispatcher::schedule(PassRefPtr<Element> element)
-{
- CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element);
- if (!callbackQueue->inCreatedCallback())
- ensureInCurrentElementQueue(callbackQueue);
- return callbackQueue;
-}
-
-// Finds or creates the callback queue for element. If the element's
-// callback queue is scheduled in an earlier processing stack frame,
-// its owner is set to the element queue on the top of the processing
-// stack. Because callback queues are processed exhaustively, this
-// effectively moves the callback queue to the top of the stack.
-CustomElementCallbackQueue* CustomElementCallbackDispatcher::scheduleInCurrentElementQueue(PassRefPtr<Element> element)
-{
- CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element);
- ensureInCurrentElementQueue(callbackQueue);
- return callbackQueue;
-}
-
-void CustomElementCallbackDispatcher::ensureInCurrentElementQueue(CustomElementCallbackQueue* callbackQueue)
+void CustomElementCallbackDispatcher::enqueue(CustomElementCallbackQueue* callbackQueue)
{
if (callbackQueue->owner() == currentElementQueue())
return;
diff --git a/Source/core/dom/CustomElementCallbackDispatcher.h b/Source/core/dom/CustomElementCallbackDispatcher.h
index f26ec9b..1230179 100644
--- a/Source/core/dom/CustomElementCallbackDispatcher.h
+++ b/Source/core/dom/CustomElementCallbackDispatcher.h
@@ -31,15 +31,13 @@
#ifndef CustomElementCallbackDispatcher_h
#define CustomElementCallbackDispatcher_h
-#include "core/dom/CustomElementCallbackQueue.h"
-#include "core/dom/Element.h"
-#include "wtf/HashMap.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassRefPtr.h"
#include "wtf/Vector.h"
namespace WebCore {
+class CustomElementCallbackQueue;
+class CustomElementCallbackScheduler;
+
class CustomElementCallbackDispatcher {
WTF_MAKE_NONCOPYABLE(CustomElementCallbackDispatcher);
public:
@@ -72,9 +70,7 @@
protected:
friend class CustomElementCallbackScheduler;
-
- CustomElementCallbackQueue* schedule(PassRefPtr<Element>);
- CustomElementCallbackQueue* scheduleInCurrentElementQueue(PassRefPtr<Element>);
+ void enqueue(CustomElementCallbackQueue*);
private:
CustomElementCallbackDispatcher()
@@ -106,17 +102,11 @@
static void processElementQueueAndPop();
void processElementQueueAndPop(size_t start, size_t end);
- CustomElementCallbackQueue* ensureCallbackQueue(PassRefPtr<Element>);
- void ensureInCurrentElementQueue(CustomElementCallbackQueue*);
-
// The processing stack, flattened. Element queues lower in the
// stack appear toward the head of the vector. The first element
// is a null sentinel value.
static const size_t kNumSentinels = 1;
Vector<CustomElementCallbackQueue*> m_flattenedProcessingStack;
-
- typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallbackQueueMap;
- ElementCallbackQueueMap m_elementCallbackQueueMap;
};
}
diff --git a/Source/core/dom/CustomElementCallbackQueue.cpp b/Source/core/dom/CustomElementCallbackQueue.cpp
index 7078364..114b21f 100644
--- a/Source/core/dom/CustomElementCallbackQueue.cpp
+++ b/Source/core/dom/CustomElementCallbackQueue.cpp
@@ -31,8 +31,6 @@
#include "config.h"
#include "core/dom/CustomElementCallbackQueue.h"
-#include "core/dom/Element.h"
-
namespace WebCore {
PassOwnPtr<CustomElementCallbackQueue> CustomElementCallbackQueue::create(PassRefPtr<Element> element)
diff --git a/Source/core/dom/CustomElementCallbackQueue.h b/Source/core/dom/CustomElementCallbackQueue.h
index 430766f..9afdeed 100644
--- a/Source/core/dom/CustomElementCallbackQueue.h
+++ b/Source/core/dom/CustomElementCallbackQueue.h
@@ -32,6 +32,7 @@
#define CustomElementCallbackQueue_h
#include "core/dom/CustomElementCallbackInvocation.h"
+#include "core/dom/Element.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
diff --git a/Source/core/dom/CustomElementCallbackScheduler.cpp b/Source/core/dom/CustomElementCallbackScheduler.cpp
index 31c8252..d6086cd 100644
--- a/Source/core/dom/CustomElementCallbackScheduler.cpp
+++ b/Source/core/dom/CustomElementCallbackScheduler.cpp
@@ -43,7 +43,7 @@
if (!callbacks->hasAttributeChangedCallback())
return;
- CustomElementCallbackQueue* queue = CustomElementCallbackDispatcher::instance().schedule(element);
+ CustomElementCallbackQueue* queue = instance().schedule(element);
queue->append(CustomElementCallbackInvocation::createAttributeChangedInvocation(callbacks, name, oldValue, newValue));
}
@@ -52,7 +52,7 @@
if (!callbacks->hasCreatedCallback())
return;
- CustomElementCallbackQueue* queue = CustomElementCallbackDispatcher::instance().scheduleInCurrentElementQueue(element);
+ CustomElementCallbackQueue* queue = instance().scheduleInCurrentElementQueue(element);
queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::Created));
}
@@ -61,7 +61,7 @@
if (!callbacks->hasEnteredViewCallback())
return;
- CustomElementCallbackQueue* queue = CustomElementCallbackDispatcher::instance().schedule(element);
+ CustomElementCallbackQueue* queue = instance().schedule(element);
queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::EnteredView));
}
@@ -70,8 +70,53 @@
if (!callbacks->hasLeftViewCallback())
return;
- CustomElementCallbackQueue* queue = CustomElementCallbackDispatcher::instance().schedule(element);
+ CustomElementCallbackQueue* queue = instance().schedule(element);
queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::LeftView));
}
+CustomElementCallbackScheduler& CustomElementCallbackScheduler::instance()
+{
+ DEFINE_STATIC_LOCAL(CustomElementCallbackScheduler, instance, ());
+ return instance;
+}
+
+CustomElementCallbackQueue* CustomElementCallbackScheduler::ensureCallbackQueue(PassRefPtr<Element> element)
+{
+ Element* key = element.get();
+ ElementCallbackQueueMap::iterator it = m_elementCallbackQueueMap.find(key);
+ if (it == m_elementCallbackQueueMap.end())
+ it = m_elementCallbackQueueMap.add(key, CustomElementCallbackQueue::create(element)).iterator;
+ return it->value.get();
+}
+
+void CustomElementCallbackScheduler::clearElementCallbackQueueMap()
+{
+ ElementCallbackQueueMap emptyMap;
+ instance().m_elementCallbackQueueMap.swap(emptyMap);
+}
+
+// Finds or creates the callback queue for element. If the
+// createdCallback has not finished running, the callback queue is not
+// moved to the top-of-stack. Otherwise like
+// scheduleInCurrentElementQueue.
+CustomElementCallbackQueue* CustomElementCallbackScheduler::schedule(PassRefPtr<Element> element)
+{
+ CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element);
+ if (!callbackQueue->inCreatedCallback())
+ CustomElementCallbackDispatcher::instance().enqueue(callbackQueue);
+ return callbackQueue;
+}
+
+// Finds or creates the callback queue for element. If the element's
+// callback queue is scheduled in an earlier processing stack frame,
+// its owner is set to the element queue on the top of the processing
+// stack. Because callback queues are processed exhaustively, this
+// effectively moves the callback queue to the top of the stack.
+CustomElementCallbackQueue* CustomElementCallbackScheduler::scheduleInCurrentElementQueue(PassRefPtr<Element> element)
+{
+ CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element);
+ CustomElementCallbackDispatcher::instance().enqueue(callbackQueue);
+ return callbackQueue;
+}
+
} // namespace WebCore
diff --git a/Source/core/dom/CustomElementCallbackScheduler.h b/Source/core/dom/CustomElementCallbackScheduler.h
index 42542e5..b0e757f 100644
--- a/Source/core/dom/CustomElementCallbackScheduler.h
+++ b/Source/core/dom/CustomElementCallbackScheduler.h
@@ -31,6 +31,9 @@
#ifndef CustomElementCallbackScheduler_h
#define CustomElementCallbackScheduler_h
+#include "core/dom/CustomElementCallbackQueue.h"
+#include "wtf/HashMap.h"
+#include "wtf/OwnPtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/text/AtomicString.h"
@@ -46,8 +49,21 @@
static void scheduleEnteredViewCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
static void scheduleLeftViewCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
+protected:
+ friend class CustomElementCallbackDispatcher;
+ static void clearElementCallbackQueueMap();
+
private:
- CustomElementCallbackScheduler();
+ CustomElementCallbackScheduler() { }
+
+ static CustomElementCallbackScheduler& instance();
+
+ CustomElementCallbackQueue* ensureCallbackQueue(PassRefPtr<Element>);
+ CustomElementCallbackQueue* schedule(PassRefPtr<Element>);
+ CustomElementCallbackQueue* scheduleInCurrentElementQueue(PassRefPtr<Element>);
+
+ typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallbackQueueMap;
+ ElementCallbackQueueMap m_elementCallbackQueueMap;
};
}
diff --git a/Source/core/dom/CustomElementException.cpp b/Source/core/dom/CustomElementException.cpp
index 73b1717..3f2ccaa 100644
--- a/Source/core/dom/CustomElementException.cpp
+++ b/Source/core/dom/CustomElementException.cpp
@@ -57,11 +57,11 @@
return;
case ContextDestroyedCreatingCallbacks:
- es.throwDOMException(InvalidStateError);
+ es.throwUninformativeAndGenericDOMException(InvalidStateError);
return;
case ContextDestroyedRegisteringDefinition:
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return;
case ExtendsIsInvalidName:
diff --git a/Source/core/dom/CustomEvent.cpp b/Source/core/dom/CustomEvent.cpp
deleted file mode 100644
index c46919d..0000000
--- a/Source/core/dom/CustomEvent.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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 "core/dom/CustomEvent.h"
-
-#include "bindings/v8/SerializedScriptValue.h"
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-CustomEvent::CustomEvent()
-{
- ScriptWrappable::init(this);
-}
-
-CustomEvent::CustomEvent(const AtomicString& type, const CustomEventInit& initializer)
- : Event(type, initializer)
-{
- ScriptWrappable::init(this);
-}
-
-CustomEvent::~CustomEvent()
-{
-}
-
-void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> serializedDetail)
-{
- if (dispatched())
- return;
-
- initEvent(type, canBubble, cancelable);
-
- m_serializedDetail = serializedDetail;
-}
-
-const AtomicString& CustomEvent::interfaceName() const
-{
- return eventNames().interfaceForCustomEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CustomEvent.h b/Source/core/dom/CustomEvent.h
deleted file mode 100644
index d67c8c7..0000000
--- a/Source/core/dom/CustomEvent.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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 CustomEvent_h
-#define CustomEvent_h
-
-#include "core/dom/Event.h"
-
-namespace WebCore {
-
-class SerializedScriptValue;
-
-typedef EventInit CustomEventInit;
-
-class CustomEvent : public Event {
-public:
- virtual ~CustomEvent();
-
- static PassRefPtr<CustomEvent> create()
- {
- return adoptRef(new CustomEvent);
- }
-
- static PassRefPtr<CustomEvent> create(const AtomicString& type, const CustomEventInit& initializer)
- {
- return adoptRef(new CustomEvent(type, initializer));
- }
-
- void initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue>);
-
- virtual const AtomicString& interfaceName() const;
-
- SerializedScriptValue* serializedDetail() { return m_serializedDetail.get(); }
-
- void setSerializedDetail(PassRefPtr<SerializedScriptValue> detail)
- {
- ASSERT(!m_serializedDetail);
- m_serializedDetail = detail;
- }
-
-private:
- CustomEvent();
- CustomEvent(const AtomicString& type, const CustomEventInit& initializer);
-
- RefPtr<SerializedScriptValue> m_serializedDetail;
-};
-
-} // namespace WebCore
-
-#endif // CustomEvent_h
diff --git a/Source/core/dom/CustomEvent.idl b/Source/core/dom/CustomEvent.idl
deleted file mode 100644
index 12edaa5..0000000
--- a/Source/core/dom/CustomEvent.idl
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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.
- */
-
-[
- ConstructorTemplate=Event
-] interface CustomEvent : Event {
- [InitializedByEventConstructor, Custom] readonly attribute any detail;
-
- [Custom] void initCustomEvent([Default=Undefined] optional DOMString typeArg,
- [Default=Undefined] optional boolean canBubbleArg,
- [Default=Undefined] optional boolean cancelableArg,
- [Default=Undefined] optional any detailArg);
-};
diff --git a/Source/core/dom/DOMTokenList.cpp b/Source/core/dom/DOMTokenList.cpp
index 9b48609..71a123a 100644
--- a/Source/core/dom/DOMTokenList.cpp
+++ b/Source/core/dom/DOMTokenList.cpp
@@ -35,14 +35,14 @@
bool DOMTokenList::validateToken(const AtomicString& token, ExceptionState& es)
{
if (token.isEmpty()) {
- es.throwDOMException(SyntaxError);
+ es.throwUninformativeAndGenericDOMException(SyntaxError);
return false;
}
unsigned length = token.length();
for (unsigned i = 0; i < length; ++i) {
- if (isHTMLSpace(token[i])) {
- es.throwDOMException(InvalidCharacterError);
+ if (isHTMLSpace<UChar>(token[i])) {
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return false;
}
}
@@ -171,7 +171,7 @@
StringBuilder builder;
if (!input.isEmpty()) {
builder.append(input);
- needsSpace = !isHTMLSpace(input[input.length() - 1]);
+ needsSpace = !isHTMLSpace<UChar>(input[input.length() - 1]);
}
for (size_t i = 0; i < tokens.size(); ++i) {
@@ -203,26 +203,26 @@
// Step 5
while (position < inputLength) {
- if (isHTMLSpace(input[position])) { // 6
+ if (isHTMLSpace<UChar>(input[position])) { // 6
output.append(input[position++]); // 6.1, 6.2
continue; // 6.3
}
// Step 7
StringBuilder tokenBuilder;
- while (position < inputLength && isNotHTMLSpace(input[position]))
+ while (position < inputLength && isNotHTMLSpace<UChar>(input[position]))
tokenBuilder.append(input[position++]);
// Step 8
String token = tokenBuilder.toString();
if (tokens.contains(token)) {
// Step 8.1
- while (position < inputLength && isHTMLSpace(input[position]))
+ while (position < inputLength && isHTMLSpace<UChar>(input[position]))
++position;
// Step 8.2
size_t j = output.length();
- while (j > 0 && isHTMLSpace(output[j - 1]))
+ while (j > 0 && isHTMLSpace<UChar>(output[j - 1]))
--j;
output.resize(j);
diff --git a/Source/core/dom/DatasetDOMStringMap.cpp b/Source/core/dom/DatasetDOMStringMap.cpp
index fbeaa54..309dabf 100644
--- a/Source/core/dom/DatasetDOMStringMap.cpp
+++ b/Source/core/dom/DatasetDOMStringMap.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "core/dom/DatasetDOMStringMap.h"
+#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "core/dom/Attribute.h"
#include "core/dom/Element.h"
@@ -180,7 +181,7 @@
void DatasetDOMStringMap::setItem(const String& name, const String& value, ExceptionState& es)
{
if (!isValidPropertyName(name)) {
- es.throwDOMException(SyntaxError);
+ es.throwDOMException(SyntaxError, ExceptionMessages::failedToSet(name, "DOMStringMap", "'" + name + "' is not a valid property name."));
return;
}
@@ -190,7 +191,7 @@
void DatasetDOMStringMap::deleteItem(const String& name, ExceptionState& es)
{
if (!isValidPropertyName(name)) {
- es.throwDOMException(SyntaxError);
+ es.throwDOMException(SyntaxError, ExceptionMessages::failedToDelete(name, "DOMStringMap", "'" + name + "' is not a valid property name."));
return;
}
diff --git a/Source/core/dom/DecodedDataDocumentParser.cpp b/Source/core/dom/DecodedDataDocumentParser.cpp
index 06ce4e7..7ac890e 100644
--- a/Source/core/dom/DecodedDataDocumentParser.cpp
+++ b/Source/core/dom/DecodedDataDocumentParser.cpp
@@ -41,6 +41,9 @@
if (!length)
return 0;
+ if (isStopped())
+ return 0;
+
String decoded = document()->decoder()->decode(data, length);
document()->setEncoding(document()->decoder()->encoding());
@@ -55,6 +58,9 @@
size_t DecodedDataDocumentParser::flush()
{
+ if (isStopped())
+ return 0;
+
// null decoder indicates there is no data received.
// We have nothing to do in that case.
TextResourceDecoder* decoder = document()->decoder();
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 7417915..e536173 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -55,14 +55,14 @@
#include "core/css/resolver/FontBuilder.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Attr.h"
-#include "core/dom/BeforeUnloadEvent.h"
+#include "core/events/BeforeUnloadEvent.h"
#include "core/dom/CDATASection.h"
#include "core/dom/Comment.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/CustomElementRegistrationContext.h"
#include "core/dom/DOMImplementation.h"
#include "core/dom/DOMNamedFlowCollection.h"
-#include "core/dom/DocumentEventQueue.h"
+#include "core/events/DocumentEventQueue.h"
#include "core/dom/DocumentFragment.h"
#include "core/dom/DocumentLifecycleObserver.h"
#include "core/dom/DocumentMarkerController.h"
@@ -70,12 +70,12 @@
#include "core/dom/DocumentType.h"
#include "core/dom/Element.h"
#include "core/dom/ElementTraversal.h"
-#include "core/dom/Event.h"
-#include "core/dom/EventFactory.h"
-#include "core/dom/EventListener.h"
-#include "core/dom/EventNames.h"
+#include "core/events/Event.h"
+#include "core/events/EventFactory.h"
+#include "core/events/EventListener.h"
+#include "core/events/EventNames.h"
#include "core/dom/ExceptionCode.h"
-#include "core/dom/HashChangeEvent.h"
+#include "core/events/HashChangeEvent.h"
#include "core/dom/NamedFlowCollection.h"
#include "core/dom/NodeFilter.h"
#include "core/dom/NodeIterator.h"
@@ -84,13 +84,13 @@
#include "core/dom/NodeRenderingTraversal.h"
#include "core/dom/NodeTraversal.h"
#include "core/dom/NodeWithIndex.h"
-#include "core/dom/PageTransitionEvent.h"
-#include "core/dom/PopStateEvent.h"
+#include "core/events/PageTransitionEvent.h"
+#include "core/events/PopStateEvent.h"
#include "core/dom/PostAttachCallbacks.h"
#include "core/dom/ProcessingInstruction.h"
#include "core/dom/QualifiedName.h"
#include "core/dom/RequestAnimationFrameCallback.h"
-#include "core/dom/ScopedEventQueue.h"
+#include "core/events/ScopedEventQueue.h"
#include "core/dom/ScriptRunner.h"
#include "core/dom/ScriptedAnimationController.h"
#include "core/dom/SelectorQuery.h"
@@ -106,7 +106,6 @@
#include "core/editing/FrameSelection.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/TextResourceDecoder.h"
-#include "core/html/FormController.h"
#include "core/html/HTMLAllCollection.h"
#include "core/html/HTMLAnchorElement.h"
#include "core/html/HTMLCanvasElement.h"
@@ -125,6 +124,7 @@
#include "core/html/HTMLStyleElement.h"
#include "core/html/HTMLTitleElement.h"
#include "core/html/PluginDocument.h"
+#include "core/html/forms/FormController.h"
#include "core/html/parser/HTMLDocumentParser.h"
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/html/parser/NestingLevelIncrementer.h"
@@ -690,7 +690,7 @@
PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionState& es)
{
if (!isValidName(name)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return 0;
}
@@ -703,7 +703,7 @@
PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState& es)
{
if (!isValidName(localName)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return 0;
}
@@ -728,7 +728,7 @@
QualifiedName qName(prefix, localName, namespaceURI);
if (!hasValidNamespaceForElements(qName)) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return 0;
}
@@ -752,7 +752,7 @@
ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicString& name, const Dictionary& options, ExceptionState& es, CustomElement::NameSet validNames)
{
if (!registrationContext()) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return ScriptValue();
}
@@ -795,10 +795,10 @@
PassRefPtr<CDATASection> Document::createCDATASection(const String& data, ExceptionState& es)
{
if (isHTMLDocument()) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
- if (data.find("]]>") != WTF::notFound) {
+ if (data.find("]]>") != WTF::kNotFound) {
es.throwDOMException(InvalidCharacterError, "String cannot contain ']]>' since that is the end delimiter of a CData section.");
return 0;
}
@@ -808,11 +808,11 @@
PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String& target, const String& data, ExceptionState& es)
{
if (!isValidName(target)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return 0;
}
if (isHTMLDocument()) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return ProcessingInstruction::create(*this, target, data);
@@ -831,7 +831,7 @@
PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionState& es)
{
if (!importedNode) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
@@ -849,7 +849,7 @@
// FIXME: The following check might be unnecessary. Is it possible that
// oldElement has mismatched prefix/namespace?
if (!hasValidNamespaceForElements(oldElement->tagQName())) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return 0;
}
RefPtr<Element> newElement = createElement(oldElement->tagQName(), false);
@@ -901,14 +901,14 @@
case XPATH_NAMESPACE_NODE:
break;
}
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& es)
{
if (!source) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
@@ -920,7 +920,7 @@
case DOCUMENT_NODE:
case DOCUMENT_TYPE_NODE:
case XPATH_NAMESPACE_NODE:
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
case ATTRIBUTE_NODE: {
Attr* attr = toAttr(source.get());
@@ -932,14 +932,14 @@
default:
if (source->isShadowRoot()) {
// ShadowRoot cannot disconnect itself from the host node.
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return 0;
}
if (source->isFrameOwnerElement()) {
HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(source.get());
if (frame() && frame()->tree()->isDescendantOf(frameOwnerElement->contentFrame())) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return 0;
}
}
@@ -1047,7 +1047,7 @@
QualifiedName qName(prefix, localName, namespaceURI);
if (!hasValidNamespaceForElements(qName)) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return 0;
}
@@ -1136,12 +1136,12 @@
void Document::setXMLVersion(const String& version, ExceptionState& es)
{
if (!implementation()->hasFeature("XML", String())) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return;
}
if (!XMLDocumentParser::supportsXMLVersion(version)) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return;
}
@@ -1151,7 +1151,7 @@
void Document::setXMLStandalone(bool standalone, ExceptionState& es)
{
if (!implementation()->hasFeature("XML", String())) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return;
}
@@ -1452,7 +1452,7 @@
{
// FIXME: Probably this should be handled within the bindings layer and TypeError should be thrown.
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>());
@@ -1461,7 +1461,7 @@
PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
// FIXME: It might be a good idea to emit a warning if |whatToShow| contains a bit that is not defined in
@@ -1472,7 +1472,7 @@
PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
// FIXME: Ditto.
@@ -1482,7 +1482,7 @@
PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
// FIXME: Warn if |expandEntityReferences| is specified. This optional argument is deprecated in DOM4.
@@ -1493,7 +1493,7 @@
PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>());
@@ -1502,7 +1502,7 @@
PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return TreeWalker::create(root, whatToShow, PassRefPtr<NodeFilter>());
@@ -1511,7 +1511,7 @@
PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionState& es)
{
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return TreeWalker::create(root, whatToShow, filter);
@@ -1521,7 +1521,7 @@
{
UNUSED_PARAM(expandEntityReferences);
if (!root) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
return TreeWalker::create(root, whatToShow, filter);
@@ -2260,12 +2260,12 @@
RefPtr<HTMLElement> newBody = prpNewBody;
if (!newBody || !documentElement()) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
if (!newBody->hasTagName(bodyTag) && !newBody->hasTagName(framesetTag)) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
@@ -3680,6 +3680,9 @@
(*it)->didMergeTextNodes(oldNodeWithIndex, offset);
}
+ if (m_frame)
+ m_frame->selection().didMergeTextNodes(*oldNode, offset);
+
// FIXME: This should update markers for spelling and grammar checking.
}
@@ -3740,7 +3743,7 @@
if (event)
return event.release();
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
@@ -4035,7 +4038,7 @@
U16_NEXT(characters, i, length, c)
if (c == ':') {
if (sawColon) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return false; // multiple colons: not allowed
}
nameStart = true;
@@ -4043,13 +4046,13 @@
colonPos = i - 1;
} else if (nameStart) {
if (!isValidNameStart(c)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return false;
}
nameStart = false;
} else {
if (!isValidNamePart(c)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return false;
}
}
@@ -4061,14 +4064,14 @@
} else {
prefix = qualifiedName.substring(0, colonPos);
if (prefix.isEmpty()) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return false;
}
localName = qualifiedName.substring(colonPos + 1);
}
if (localName.isEmpty()) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return false;
}
@@ -4080,7 +4083,7 @@
unsigned length = qualifiedName.length();
if (!length) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return false;
}
@@ -4315,7 +4318,7 @@
QualifiedName qName(prefix, localName, namespaceURI);
if (!shouldIgnoreNamespaceChecks && !hasValidNamespaceForAttributes(qName)) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return 0;
}
@@ -4956,7 +4959,7 @@
if (!element->isInTopLayer())
return;
size_t position = m_topLayerElements.find(element);
- ASSERT(position != notFound);
+ ASSERT(position != kNotFound);
m_topLayerElements.remove(position);
element->setIsInTopLayer(false);
}
@@ -5374,6 +5377,11 @@
m_associatedFormControls.clear();
}
+float Document::devicePixelRatio() const
+{
+ return m_frame ? m_frame->devicePixelRatio() : 1.0;
+}
+
PassOwnPtr<LifecycleNotifier> Document::createLifecycleNotifier()
{
return DocumentLifecycleNotifier::create(this);
diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h
index 0e46a60..5960a6c 100644
--- a/Source/core/dom/Document.h
+++ b/Source/core/dom/Document.h
@@ -32,7 +32,7 @@
#include "core/dom/ContainerNode.h"
#include "core/dom/CustomElement.h"
#include "core/dom/DOMTimeStamp.h"
-#include "core/dom/DocumentEventQueue.h"
+#include "core/events/DocumentEventQueue.h"
#include "core/dom/DocumentInit.h"
#include "core/dom/DocumentTiming.h"
#include "core/dom/IconURL.h"
@@ -461,10 +461,12 @@
Vector<String> formElementsState() const;
void setStateForNewFormElements(const Vector<String>&);
- FrameView* view() const; // can be NULL
- Frame* frame() const { return m_frame; } // can be NULL
- Page* page() const; // can be NULL
- Settings* settings() const; // can be NULL
+ FrameView* view() const; // can be null
+ Frame* frame() const { return m_frame; } // can be null
+ Page* page() const; // can be null
+ Settings* settings() const; // can be null
+
+ float devicePixelRatio() const;
PassRefPtr<Range> createRange();
diff --git a/Source/core/dom/DocumentEventQueue.cpp b/Source/core/dom/DocumentEventQueue.cpp
deleted file mode 100644
index eba99c1..0000000
--- a/Source/core/dom/DocumentEventQueue.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 "core/dom/DocumentEventQueue.h"
-
-#include "core/dom/Document.h"
-#include "core/dom/Event.h"
-#include "core/dom/EventNames.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/SuspendableTimer.h"
-
-namespace WebCore {
-
-class DocumentEventQueueTimer : public SuspendableTimer {
- WTF_MAKE_NONCOPYABLE(DocumentEventQueueTimer);
-public:
- DocumentEventQueueTimer(DocumentEventQueue* eventQueue, ScriptExecutionContext* context)
- : SuspendableTimer(context)
- , m_eventQueue(eventQueue) { }
-
-private:
- virtual void fired() { m_eventQueue->pendingEventTimerFired(); }
- DocumentEventQueue* m_eventQueue;
-};
-
-PassRefPtr<DocumentEventQueue> DocumentEventQueue::create(ScriptExecutionContext* context)
-{
- return adoptRef(new DocumentEventQueue(context));
-}
-
-DocumentEventQueue::DocumentEventQueue(ScriptExecutionContext* context)
- : m_pendingEventTimer(adoptPtr(new DocumentEventQueueTimer(this, context)))
- , m_isClosed(false)
-{
- m_pendingEventTimer->suspendIfNeeded();
-}
-
-DocumentEventQueue::~DocumentEventQueue()
-{
-}
-
-bool DocumentEventQueue::enqueueEvent(PassRefPtr<Event> event)
-{
- if (m_isClosed)
- return false;
-
- ASSERT(event->target());
- bool wasAdded = m_queuedEvents.add(event).isNewEntry;
- ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the list.
-
- if (!m_pendingEventTimer->isActive())
- m_pendingEventTimer->startOneShot(0);
-
- return true;
-}
-
-void DocumentEventQueue::enqueueOrDispatchScrollEvent(PassRefPtr<Node> target, ScrollEventTargetType targetType)
-{
- if (!target->document().hasListenerType(Document::SCROLL_LISTENER))
- return;
-
- // Per the W3C CSSOM View Module, scroll events fired at the document should bubble, others should not.
- RefPtr<Event> scrollEvent = targetType == ScrollEventDocumentTarget ? Event::createBubble(eventNames().scrollEvent) : Event::create(eventNames().scrollEvent);
-
- if (!m_nodesWithQueuedScrollEvents.add(target.get()).isNewEntry)
- return;
-
- scrollEvent->setTarget(target);
- enqueueEvent(scrollEvent.release());
-}
-
-bool DocumentEventQueue::cancelEvent(Event* event)
-{
- ListHashSet<RefPtr<Event>, 16>::iterator it = m_queuedEvents.find(event);
- bool found = it != m_queuedEvents.end();
- if (found)
- m_queuedEvents.remove(it);
- if (m_queuedEvents.isEmpty())
- m_pendingEventTimer->stop();
- return found;
-}
-
-void DocumentEventQueue::close()
-{
- m_isClosed = true;
- m_pendingEventTimer->stop();
- m_queuedEvents.clear();
-}
-
-void DocumentEventQueue::pendingEventTimerFired()
-{
- ASSERT(!m_pendingEventTimer->isActive());
- ASSERT(!m_queuedEvents.isEmpty());
-
- m_nodesWithQueuedScrollEvents.clear();
-
- // Insert a marker for where we should stop.
- ASSERT(!m_queuedEvents.contains(0));
- bool wasAdded = m_queuedEvents.add(0).isNewEntry;
- ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the list.
-
- RefPtr<DocumentEventQueue> protector(this);
-
- while (!m_queuedEvents.isEmpty()) {
- ListHashSet<RefPtr<Event>, 16>::iterator iter = m_queuedEvents.begin();
- RefPtr<Event> event = *iter;
- m_queuedEvents.remove(iter);
- if (!event)
- break;
- dispatchEvent(event.get());
- }
-}
-
-void DocumentEventQueue::dispatchEvent(PassRefPtr<Event> event)
-{
- EventTarget* eventTarget = event->target();
- if (eventTarget->toDOMWindow())
- eventTarget->toDOMWindow()->dispatchEvent(event, 0);
- else
- eventTarget->dispatchEvent(event);
-}
-
-}
diff --git a/Source/core/dom/DocumentEventQueue.h b/Source/core/dom/DocumentEventQueue.h
deleted file mode 100644
index bd8fb76..0000000
--- a/Source/core/dom/DocumentEventQueue.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 DocumentEventQueue_h
-#define DocumentEventQueue_h
-
-#include "core/dom/EventQueue.h"
-#include "wtf/Forward.h"
-#include "wtf/HashSet.h"
-#include "wtf/ListHashSet.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class Event;
-class DocumentEventQueueTimer;
-class Node;
-class ScriptExecutionContext;
-
-class DocumentEventQueue : public RefCounted<DocumentEventQueue>, public EventQueue {
-public:
- enum ScrollEventTargetType {
- ScrollEventDocumentTarget,
- ScrollEventElementTarget
- };
-
- static PassRefPtr<DocumentEventQueue> create(ScriptExecutionContext*);
- virtual ~DocumentEventQueue();
-
- // EventQueue
- virtual bool enqueueEvent(PassRefPtr<Event>) OVERRIDE;
- virtual bool cancelEvent(Event*) OVERRIDE;
- virtual void close() OVERRIDE;
-
- void enqueueOrDispatchScrollEvent(PassRefPtr<Node>, ScrollEventTargetType);
-
-private:
- explicit DocumentEventQueue(ScriptExecutionContext*);
-
- void pendingEventTimerFired();
- void dispatchEvent(PassRefPtr<Event>);
-
- OwnPtr<DocumentEventQueueTimer> m_pendingEventTimer;
- ListHashSet<RefPtr<Event>, 16> m_queuedEvents;
- HashSet<Node*> m_nodesWithQueuedScrollEvents;
- bool m_isClosed;
-
- friend class DocumentEventQueueTimer;
-};
-
-}
-
-#endif // DocumentEventQueue_h
diff --git a/Source/core/dom/DocumentMarker.h b/Source/core/dom/DocumentMarker.h
index b6072b9..32bf502 100644
--- a/Source/core/dom/DocumentMarker.h
+++ b/Source/core/dom/DocumentMarker.h
@@ -38,10 +38,17 @@
// for all types other than type TextMatch.
class DocumentMarker {
public:
+ enum MarkerTypeIndex {
+ SpellingMarkerIndex = 0,
+ GramarMarkerIndex,
+ TextMatchMarkerIndex,
+ MarkerTypeIndexesCount
+ };
+
enum MarkerType {
- Spelling = 1 << 0,
- Grammar = 1 << 1,
- TextMatch = 1 << 2
+ Spelling = 1 << SpellingMarkerIndex,
+ Grammar = 1 << GramarMarkerIndex,
+ TextMatch = 1 << TextMatchMarkerIndex
};
class MarkerTypes {
@@ -68,6 +75,14 @@
}
};
+ class MisspellingMarkers : public MarkerTypes {
+ public:
+ MisspellingMarkers()
+ : MarkerTypes(Spelling | Grammar)
+ {
+ }
+ };
+
DocumentMarker();
DocumentMarker(MarkerType, unsigned startOffset, unsigned endOffset);
DocumentMarker(MarkerType, unsigned startOffset, unsigned endOffset, const String& description);
diff --git a/Source/core/dom/DocumentMarkerController.cpp b/Source/core/dom/DocumentMarkerController.cpp
index 0682b64..eb23578 100644
--- a/Source/core/dom/DocumentMarkerController.cpp
+++ b/Source/core/dom/DocumentMarkerController.cpp
@@ -40,6 +40,25 @@
namespace WebCore {
+namespace {
+
+DocumentMarker::MarkerTypeIndex MarkerTypeToMarkerIndex(DocumentMarker::MarkerType type)
+{
+ switch (type) {
+ case DocumentMarker::Spelling:
+ return DocumentMarker::SpellingMarkerIndex;
+ case DocumentMarker::Grammar:
+ return DocumentMarker::GramarMarkerIndex;
+ case DocumentMarker::TextMatch:
+ return DocumentMarker::TextMatchMarkerIndex;
+ }
+
+ ASSERT_NOT_REACHED();
+ return DocumentMarker::SpellingMarkerIndex;
+}
+
+} // namespace
+
inline bool DocumentMarkerController::possiblyHasMarkers(DocumentMarker::MarkerTypes types)
{
return m_possiblyExistingMarkerTypes.intersects(types);
@@ -114,7 +133,7 @@
// matches off-screen are (that haven't been painted yet).
Node* node = textPiece->startContainer();
Vector<DocumentMarker*> markers = markersFor(node);
- static_cast<RenderedDocumentMarker*>(markers[markers.size() - 1])->setRenderedRect(range->boundingBox());
+ toRenderedDocumentMarker(markers[markers.size() - 1])->setRenderedRect(range->boundingBox());
}
}
}
@@ -133,6 +152,36 @@
}
}
+static bool startsFurther(const DocumentMarker& lhv, const DocumentMarker& rhv)
+{
+ return lhv.startOffset() < rhv.startOffset();
+}
+
+static bool startsAfter(const DocumentMarker& marker, size_t startOffset)
+{
+ return marker.startOffset() < startOffset;
+}
+
+static bool endsBefore(size_t startOffset, const DocumentMarker& rhv)
+{
+ return startOffset < rhv.endOffset();
+}
+
+static bool compareByStart(const DocumentMarker* lhv, const DocumentMarker* rhv)
+{
+ return startsFurther(*lhv, *rhv);
+}
+
+static bool doesNotOverlap(const DocumentMarker& lhv, const DocumentMarker& rhv)
+{
+ return lhv.endOffset() < rhv.startOffset();
+}
+
+static bool doesNotInclude(const DocumentMarker& marker, size_t startOffset)
+{
+ return marker.endOffset() < startOffset;
+}
+
// Markers are stored in order sorted by their start offset.
// Markers of the same type do not overlap each other.
@@ -144,49 +193,28 @@
m_possiblyExistingMarkerTypes.add(newMarker.type());
- OwnPtr<MarkerList>& list = m_markers.add(node, nullptr).iterator->value;
+ OwnPtr<MarkerLists>& markers = m_markers.add(node, nullptr).iterator->value;
+ if (!markers) {
+ markers = adoptPtr(new MarkerLists);
+ markers->grow(DocumentMarker::MarkerTypeIndexesCount);
+ }
- if (!list) {
- list = adoptPtr(new MarkerList);
+ DocumentMarker::MarkerTypeIndex markerListIndex = MarkerTypeToMarkerIndex(newMarker.type());
+ if (!markers->at(markerListIndex)) {
+ markers->insert(markerListIndex, adoptPtr(new MarkerList));
+ }
+
+ OwnPtr<MarkerList>& list = markers->at(markerListIndex);
+ if (list->isEmpty() || list->last().endOffset() < newMarker.startOffset()) {
list->append(RenderedDocumentMarker(newMarker));
} else {
RenderedDocumentMarker toInsert(newMarker);
- size_t numMarkers = list->size();
- size_t i;
- // Iterate over all markers whose start offset is less than or equal to the new marker's.
- // If one of them is of the same type as the new marker and touches it or intersects with it
- // (there is at most one), remove it and adjust the new marker's start offset to encompass it.
- for (i = 0; i < numMarkers; ++i) {
- DocumentMarker marker = list->at(i);
- if (marker.startOffset() > toInsert.startOffset())
- break;
- if (marker.type() == toInsert.type() && marker.type() != DocumentMarker::TextMatch && marker.endOffset() >= toInsert.startOffset()) {
- toInsert.setStartOffset(marker.startOffset());
- list->remove(i);
- numMarkers--;
- break;
- }
+ if (toInsert.type() != DocumentMarker::TextMatch) {
+ mergeOverlapping(list.get(), toInsert);
+ } else {
+ MarkerList::iterator pos = std::lower_bound(list->begin(), list->end(), toInsert, startsFurther);
+ list->insert(pos - list->begin(), RenderedDocumentMarker(toInsert));
}
- size_t j = i;
- // Iterate over all markers whose end offset is less than or equal to the new marker's,
- // removing markers of the same type as the new marker which touch it or intersect with it,
- // adjusting the new marker's end offset to cover them if necessary.
- while (j < numMarkers) {
- DocumentMarker marker = list->at(j);
- if (marker.startOffset() > toInsert.endOffset())
- break;
- if (marker.type() == toInsert.type() && marker.type() != DocumentMarker::TextMatch) {
- list->remove(j);
- if (toInsert.endOffset() <= marker.endOffset()) {
- toInsert.setEndOffset(marker.endOffset());
- break;
- }
- numMarkers--;
- } else
- j++;
- }
- // At this point i points to the node before which we want to insert.
- list->insert(i, RenderedDocumentMarker(toInsert));
}
// repaint the affected node
@@ -194,6 +222,20 @@
node->renderer()->repaint();
}
+void DocumentMarkerController::mergeOverlapping(MarkerList* list, DocumentMarker& toInsert)
+{
+ MarkerList::iterator firstOverlapping = std::lower_bound(list->begin(), list->end(), toInsert, doesNotOverlap);
+ size_t index = firstOverlapping - list->begin();
+ list->insert(index, RenderedDocumentMarker(toInsert));
+ MarkerList::iterator inserted = list->begin() + index;
+ firstOverlapping = inserted + 1;
+ for (MarkerList::iterator i = firstOverlapping; i != list->end() && i->startOffset() <= inserted->endOffset(); ) {
+ inserted->setStartOffset(std::min(inserted->startOffset(), i->startOffset()));
+ inserted->setEndOffset(std::max(inserted->endOffset(), i->endOffset()));
+ list->remove(i - list->begin());
+ }
+}
+
// copies markers from srcNode to dstNode, applying the specified shift delta to the copies. The shift is
// useful if, e.g., the caller has created the dstNode from a non-prefix substring of the srcNode.
void DocumentMarkerController::copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstNode, int delta)
@@ -205,32 +247,35 @@
return;
ASSERT(!m_markers.isEmpty());
- MarkerList* list = m_markers.get(srcNode);
- if (!list)
+ MarkerLists* markers = m_markers.get(srcNode);
+ if (!markers)
return;
bool docDirty = false;
- unsigned endOffset = startOffset + length - 1;
- for (size_t i = 0; i != list->size(); ++i) {
- DocumentMarker marker = list->at(i);
-
- // stop if we are now past the specified range
- if (marker.startOffset() > endOffset)
- break;
-
- // skip marker that is before the specified range or is the wrong type
- if (marker.endOffset() < startOffset)
+ for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::MarkerTypeIndexesCount; ++markerListIndex) {
+ OwnPtr<MarkerList>& list = (*markers)[markerListIndex];
+ if (!list)
continue;
- // pin the marker to the specified range and apply the shift delta
- docDirty = true;
- if (marker.startOffset() < startOffset)
- marker.setStartOffset(startOffset);
- if (marker.endOffset() > endOffset)
- marker.setEndOffset(endOffset);
- marker.shiftOffsets(delta);
+ unsigned endOffset = startOffset + length - 1;
+ MarkerList::iterator startPos = std::lower_bound(list->begin(), list->end(), startOffset, doesNotInclude);
+ for (MarkerList::iterator i = startPos; i != list->end(); ++i) {
+ DocumentMarker marker = *i;
- addMarker(dstNode, marker);
+ // stop if we are now past the specified range
+ if (marker.startOffset() > endOffset)
+ break;
+
+ // pin the marker to the specified range and apply the shift delta
+ docDirty = true;
+ if (marker.startOffset() < startOffset)
+ marker.setStartOffset(startOffset);
+ if (marker.endOffset() > endOffset)
+ marker.setEndOffset(endOffset);
+ marker.shiftOffsets(delta);
+
+ addMarker(dstNode, marker);
+ }
}
// repaint the affected node
@@ -247,53 +292,68 @@
return;
ASSERT(!(m_markers.isEmpty()));
- MarkerList* list = m_markers.get(node);
- if (!list)
+ MarkerLists* markers = m_markers.get(node);
+ if (!markers)
return;
bool docDirty = false;
- unsigned endOffset = startOffset + length;
- for (size_t i = 0; i < list->size();) {
- DocumentMarker marker = list->at(i);
-
- // markers are returned in order, so stop if we are now past the specified range
- if (marker.startOffset() >= endOffset)
- break;
-
- // skip marker that is wrong type or before target
- if (marker.endOffset() <= startOffset || !markerTypes.contains(marker.type())) {
- i++;
+ size_t emptyListsCount = 0;
+ for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::MarkerTypeIndexesCount; ++markerListIndex) {
+ OwnPtr<MarkerList>& list = (*markers)[markerListIndex];
+ if (!list || list->isEmpty()) {
+ if (list.get() && list->isEmpty())
+ list.clear();
+ ++emptyListsCount;
continue;
}
-
- // at this point we know that marker and target intersect in some way
- docDirty = true;
-
- // pitch the old marker
- list->remove(i);
-
- if (shouldRemovePartiallyOverlappingMarker)
- // Stop here. Don't add resulting slices back.
+ if (!markerTypes.contains(list->begin()->type()))
continue;
+ unsigned endOffset = startOffset + length;
+ MarkerList::iterator startPos = std::upper_bound(list->begin(), list->end(), startOffset, endsBefore);
+ for (MarkerList::iterator i = startPos; i != list->end(); ) {
+ DocumentMarker marker = *i;
- // add either of the resulting slices that are left after removing target
- if (startOffset > marker.startOffset()) {
- DocumentMarker newLeft = marker;
- newLeft.setEndOffset(startOffset);
- list->insert(i, RenderedDocumentMarker(newLeft));
- // i now points to the newly-inserted node, but we want to skip that one
- i++;
+ // markers are returned in order, so stop if we are now past the specified range
+ if (marker.startOffset() >= endOffset)
+ break;
+
+ // at this point we know that marker and target intersect in some way
+ docDirty = true;
+
+ // pitch the old marker
+ list->remove(i - list->begin());
+
+ if (shouldRemovePartiallyOverlappingMarker) {
+ // Stop here. Don't add resulting slices back.
+ continue;
+ }
+
+ // add either of the resulting slices that are left after removing target
+ if (startOffset > marker.startOffset()) {
+ DocumentMarker newLeft = marker;
+ newLeft.setEndOffset(startOffset);
+ size_t insertIndex = i - list->begin();
+ list->insert(insertIndex , RenderedDocumentMarker(newLeft));
+ // Move to the marker after the inserted one.
+ i = list->begin() + insertIndex + 1;
+ }
+ if (marker.endOffset() > endOffset) {
+ DocumentMarker newRight = marker;
+ newRight.setStartOffset(endOffset);
+ size_t insertIndex = i - list->begin();
+ list->insert(insertIndex, RenderedDocumentMarker(newRight));
+ // Move to the marker after the inserted one.
+ i = list->begin() + insertIndex + 1;
+ }
}
- if (marker.endOffset() > endOffset) {
- DocumentMarker newRight = marker;
- newRight.setStartOffset(endOffset);
- list->insert(i, RenderedDocumentMarker(newRight));
- // i now points to the newly-inserted node, but we want to skip that one
- i++;
+
+ if (list->isEmpty()) {
+ list.clear();
+ ++emptyListsCount;
}
}
- if (list->isEmpty()) {
+ if (emptyListsCount == DocumentMarker::MarkerTypeIndexesCount) {
m_markers.remove(node);
if (m_markers.isEmpty())
m_possiblyExistingMarkerTypes = 0;
@@ -314,15 +374,12 @@
MarkerMap::iterator end = m_markers.end();
for (MarkerMap::iterator nodeIterator = m_markers.begin(); nodeIterator != end; ++nodeIterator) {
// inner loop; process each marker in this node
- MarkerList* list = nodeIterator->value.get();
- unsigned markerCount = list->size();
+ MarkerLists* markers = nodeIterator->value.get();
+ OwnPtr<MarkerList>& list = (*markers)[MarkerTypeToMarkerIndex(markerType)];
+ unsigned markerCount = list.get() ? list->size() : 0;
for (unsigned markerIndex = 0; markerIndex < markerCount; ++markerIndex) {
RenderedDocumentMarker& marker = list->at(markerIndex);
- // skip marker that is wrong type
- if (marker.type() != markerType)
- continue;
-
if (marker.contains(point))
return ▮
}
@@ -334,15 +391,21 @@
Vector<DocumentMarker*> DocumentMarkerController::markersFor(Node* node, DocumentMarker::MarkerTypes markerTypes)
{
Vector<DocumentMarker*> result;
- MarkerList* list = m_markers.get(node);
- if (!list)
+
+ MarkerLists* markers = m_markers.get(node);
+ if (!markers)
return result;
- for (size_t i = 0; i < list->size(); ++i) {
- if (markerTypes.contains(list->at(i).type()))
+ for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::MarkerTypeIndexesCount; ++markerListIndex) {
+ OwnPtr<MarkerList>& list = (*markers)[markerListIndex];
+ if (!list || list->isEmpty() || !markerTypes.contains(list->begin()->type()))
+ continue;
+
+ for (size_t i = 0; i < list->size(); ++i)
result.append(&(list->at(i)));
}
+ std::sort(result.begin(), result.end(), compareByStart);
return result;
}
@@ -350,9 +413,14 @@
{
Vector<DocumentMarker*> result;
for (MarkerMap::iterator i = m_markers.begin(); i != m_markers.end(); ++i) {
- for (size_t j = 0; j < i->value->size(); ++j)
- result.append(&(i->value->at(j)));
+ MarkerLists* markers = i->value.get();
+ for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::MarkerTypeIndexesCount; ++markerListIndex) {
+ OwnPtr<MarkerList>& list = (*markers)[markerListIndex];
+ for (size_t j = 0; list.get() && j < list->size(); ++j)
+ result.append(&(list->at(j)));
+ }
}
+ std::sort(result.begin(), result.end(), compareByStart);
return result;
}
@@ -398,19 +466,19 @@
MarkerMap::iterator end = m_markers.end();
for (MarkerMap::iterator nodeIterator = m_markers.begin(); nodeIterator != end; ++nodeIterator) {
// inner loop; process each marker in this node
- MarkerList* list = nodeIterator->value.get();
- unsigned markerCount = list->size();
- for (unsigned markerIndex = 0; markerIndex < markerCount; ++markerIndex) {
- const RenderedDocumentMarker& marker = list->at(markerIndex);
-
- // skip marker that is wrong type
- if (marker.type() != markerType)
+ MarkerLists* markers = nodeIterator->value.get();
+ for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::MarkerTypeIndexesCount; ++markerListIndex) {
+ OwnPtr<MarkerList>& list = (*markers)[markerListIndex];
+ if (!list || list->isEmpty() || list->begin()->type() != markerType)
continue;
+ for (unsigned markerIndex = 0; markerIndex < list->size(); ++markerIndex) {
+ const RenderedDocumentMarker& marker = list->at(markerIndex);
- if (!marker.isRendered())
- continue;
+ if (!marker.isRendered())
+ continue;
- result.append(marker.renderedRect());
+ result.append(marker.renderedRect());
+ }
}
}
@@ -449,30 +517,32 @@
void DocumentMarkerController::removeMarkersFromList(MarkerMap::iterator iterator, DocumentMarker::MarkerTypes markerTypes)
{
bool needsRepainting = false;
- bool listCanBeRemoved;
+ bool nodeCanBeRemoved;
+ size_t emptyListsCount = 0;
if (markerTypes == DocumentMarker::AllMarkers()) {
needsRepainting = true;
- listCanBeRemoved = true;
+ nodeCanBeRemoved = true;
} else {
- MarkerList* list = iterator->value.get();
+ MarkerLists* markers = iterator->value.get();
- for (size_t i = 0; i != list->size(); ) {
- DocumentMarker marker = list->at(i);
-
- // skip nodes that are not of the specified type
- if (!markerTypes.contains(marker.type())) {
- ++i;
+ for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::MarkerTypeIndexesCount; ++markerListIndex) {
+ OwnPtr<MarkerList>& list = (*markers)[markerListIndex];
+ if (!list || list->isEmpty()) {
+ if (list.get() && list->isEmpty())
+ list.clear();
+ ++emptyListsCount;
continue;
}
-
- // pitch the old marker
- list->remove(i);
- needsRepainting = true;
- // i now is the index of the next marker
+ if (markerTypes.contains(list->begin()->type())) {
+ list->clear();
+ list.clear();
+ ++emptyListsCount;
+ needsRepainting = true;
+ }
}
- listCanBeRemoved = list->isEmpty();
+ nodeCanBeRemoved = emptyListsCount == DocumentMarker::MarkerTypeIndexesCount;
}
if (needsRepainting) {
@@ -480,7 +550,7 @@
renderer->repaint();
}
- if (listCanBeRemoved) {
+ if (nodeCanBeRemoved) {
m_markers.remove(iterator);
if (m_markers.isEmpty())
m_possiblyExistingMarkerTypes = 0;
@@ -499,24 +569,18 @@
Node* node = i->key.get();
// inner loop: process each marker in the current node
- MarkerList* list = i->value.get();
- bool nodeNeedsRepaint = false;
- for (size_t i = 0; i != list->size(); ++i) {
- DocumentMarker marker = list->at(i);
+ MarkerLists* markers = i->value.get();
+ for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::MarkerTypeIndexesCount; ++markerListIndex) {
+ OwnPtr<MarkerList>& list = (*markers)[markerListIndex];
+ if (!list || list->isEmpty() || !markerTypes.contains(list->begin()->type()))
+ continue;
- // skip nodes that are not of the specified type
- if (markerTypes.contains(marker.type())) {
- nodeNeedsRepaint = true;
+ // cause the node to be redrawn
+ if (RenderObject* renderer = node->renderer()) {
+ renderer->repaint();
break;
}
}
-
- if (!nodeNeedsRepaint)
- continue;
-
- // cause the node to be redrawn
- if (RenderObject* renderer = node->renderer())
- renderer->repaint();
}
}
@@ -527,9 +591,12 @@
for (MarkerMap::iterator i = m_markers.begin(); i != end; ++i) {
// inner loop: process each rect in the current node
- MarkerList* list = i->value.get();
- for (size_t listIndex = 0; listIndex < list->size(); ++listIndex)
- list->at(listIndex).invalidate(r);
+ MarkerLists* markers = i->value.get();
+ for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::MarkerTypeIndexesCount; ++markerListIndex) {
+ OwnPtr<MarkerList>& list = (*markers)[markerListIndex];
+ for (size_t markerIndex = 0; list.get() && markerIndex < list->size(); ++markerIndex)
+ list->at(markerIndex).invalidate(r);
+ }
}
}
@@ -539,20 +606,23 @@
return;
ASSERT(!m_markers.isEmpty());
- MarkerList* list = m_markers.get(node);
- if (!list)
+ MarkerLists* markers = m_markers.get(node);
+ if (!markers)
return;
bool docDirty = false;
- for (size_t i = 0; i != list->size(); ++i) {
- RenderedDocumentMarker& marker = list->at(i);
- if (marker.startOffset() >= startOffset) {
- ASSERT((int)marker.startOffset() + delta >= 0);
- marker.shiftOffsets(delta);
+ for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::MarkerTypeIndexesCount; ++markerListIndex) {
+ OwnPtr<MarkerList>& list = (*markers)[markerListIndex];
+ if (!list)
+ continue;
+ MarkerList::iterator startPos = std::lower_bound(list->begin(), list->end(), startOffset, startsAfter);
+ for (MarkerList::iterator marker = startPos; marker != list->end(); ++marker) {
+ ASSERT((int)marker->startOffset() + delta >= 0);
+ marker->shiftOffsets(delta);
docDirty = true;
// Marker moved, so previously-computed rendered rectangle is now invalid
- marker.invalidate();
+ marker->invalidate();
}
}
@@ -581,23 +651,22 @@
void DocumentMarkerController::setMarkersActive(Node* node, unsigned startOffset, unsigned endOffset, bool active)
{
- MarkerList* list = m_markers.get(node);
- if (!list)
+ MarkerLists* markers = m_markers.get(node);
+ if (!markers)
return;
bool docDirty = false;
- for (size_t i = 0; i != list->size(); ++i) {
- DocumentMarker& marker = list->at(i);
+ OwnPtr<MarkerList>& list = (*markers)[MarkerTypeToMarkerIndex(DocumentMarker::TextMatch)];
+ if (!list)
+ return;
+ MarkerList::iterator startPos = std::upper_bound(list->begin(), list->end(), startOffset, endsBefore);
+ for (MarkerList::iterator marker = startPos; marker != list->end(); ++marker) {
// Markers are returned in order, so stop if we are now past the specified range.
- if (marker.startOffset() >= endOffset)
+ if (marker->startOffset() >= endOffset)
break;
- // Skip marker that is wrong type or before target.
- if (marker.endOffset() <= startOffset || marker.type() != DocumentMarker::TextMatch)
- continue;
-
- marker.setActiveMatch(active);
+ marker->setActiveMatch(active);
docDirty = true;
}
@@ -643,10 +712,13 @@
for (MarkerMap::const_iterator nodeIterator = m_markers.begin(); nodeIterator != end; ++nodeIterator) {
Node* node = nodeIterator->key.get();
fprintf(stderr, "%p", node);
- MarkerList* list = nodeIterator->value.get();
- for (unsigned markerIndex = 0; markerIndex < list->size(); ++markerIndex) {
- const DocumentMarker& marker = list->at(markerIndex);
- fprintf(stderr, " %d:[%d:%d](%d)", marker.type(), marker.startOffset(), marker.endOffset(), marker.activeMatch());
+ MarkerLists* markers = m_markers.get(node);
+ for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::MarkerTypeIndexesCount; ++markerListIndex) {
+ OwnPtr<MarkerList>& list = (*markers)[markerListIndex];
+ for (unsigned markerIndex = 0; list.get() && markerIndex < list->size(); ++markerIndex) {
+ const DocumentMarker& marker = list->at(markerIndex);
+ fprintf(stderr, " %d:[%d:%d](%d)", marker.type(), marker.startOffset(), marker.endOffset(), marker.activeMatch());
+ }
}
fprintf(stderr, "\n");
diff --git a/Source/core/dom/DocumentMarkerController.h b/Source/core/dom/DocumentMarkerController.h
index 0b14aaa..d7da987 100644
--- a/Source/core/dom/DocumentMarkerController.h
+++ b/Source/core/dom/DocumentMarkerController.h
@@ -87,7 +87,9 @@
void addMarker(Node*, const DocumentMarker&);
typedef Vector<RenderedDocumentMarker> MarkerList;
- typedef HashMap<RefPtr<Node>, OwnPtr<MarkerList> > MarkerMap;
+ typedef Vector<OwnPtr<MarkerList>, DocumentMarker::MarkerTypeIndexesCount> MarkerLists;
+ typedef HashMap<RefPtr<Node>, OwnPtr<MarkerLists> > MarkerMap;
+ void mergeOverlapping(MarkerList*, DocumentMarker&);
bool possiblyHasMarkers(DocumentMarker::MarkerTypes);
void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes);
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 1b732d9..7d79c45 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -52,9 +52,9 @@
#include "core/dom/Document.h"
#include "core/dom/DocumentSharedObjectPool.h"
#include "core/dom/ElementRareData.h"
-#include "core/dom/EventDispatcher.h"
+#include "core/events/EventDispatcher.h"
#include "core/dom/ExceptionCode.h"
-#include "core/dom/FocusEvent.h"
+#include "core/events/FocusEvent.h"
#include "core/dom/FullscreenElementStack.h"
#include "core/dom/MutationObserverInterestGroup.h"
#include "core/dom/MutationRecord.h"
@@ -361,7 +361,7 @@
return;
size_t index = elementData()->getAttributeItemIndex(name);
- if (index == notFound)
+ if (index == kNotFound)
return;
removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute);
@@ -831,40 +831,40 @@
void Element::setAttribute(const AtomicString& localName, const AtomicString& value, ExceptionState& es)
{
if (!Document::isValidName(localName)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return;
}
synchronizeAttribute(localName);
const AtomicString& caseAdjustedLocalName = shouldIgnoreAttributeCase(this) ? localName.lower() : localName;
- size_t index = elementData() ? elementData()->getAttributeItemIndex(caseAdjustedLocalName, false) : notFound;
- const QualifiedName& qName = index != notFound ? attributeItem(index)->name() : QualifiedName(nullAtom, caseAdjustedLocalName, nullAtom);
+ size_t index = elementData() ? elementData()->getAttributeItemIndex(caseAdjustedLocalName, false) : kNotFound;
+ const QualifiedName& qName = index != kNotFound ? attributeItem(index)->name() : QualifiedName(nullAtom, caseAdjustedLocalName, nullAtom);
setAttributeInternal(index, qName, value, NotInSynchronizationOfLazyAttribute);
}
void Element::setAttribute(const QualifiedName& name, const AtomicString& value)
{
synchronizeAttribute(name);
- size_t index = elementData() ? elementData()->getAttributeItemIndex(name) : notFound;
+ size_t index = elementData() ? elementData()->getAttributeItemIndex(name) : kNotFound;
setAttributeInternal(index, name, value, NotInSynchronizationOfLazyAttribute);
}
void Element::setSynchronizedLazyAttribute(const QualifiedName& name, const AtomicString& value)
{
- size_t index = elementData() ? elementData()->getAttributeItemIndex(name) : notFound;
+ size_t index = elementData() ? elementData()->getAttributeItemIndex(name) : kNotFound;
setAttributeInternal(index, name, value, InSynchronizationOfLazyAttribute);
}
inline void Element::setAttributeInternal(size_t index, const QualifiedName& name, const AtomicString& newValue, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute)
{
if (newValue.isNull()) {
- if (index != notFound)
+ if (index != kNotFound)
removeAttributeInternal(index, inSynchronizationOfLazyAttribute);
return;
}
- if (index == notFound) {
+ if (index == kNotFound) {
addAttributeInternal(name, newValue, inSynchronizationOfLazyAttribute);
return;
}
@@ -968,7 +968,7 @@
unsigned i = 0;
do {
- if (isNotHTMLSpace(characters[i]))
+ if (isNotHTMLSpace<CharacterType>(characters[i]))
break;
++i;
} while (i < length);
@@ -1606,7 +1606,7 @@
// subtrees won't work well in that element. Until they are fixed, we disable
// adding author shadow root for them.
if (!areAuthorShadowsAllowed()) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return 0;
}
return ensureShadow()->addShadowRoot(this, ShadowRoot::AuthorShadowRoot);
@@ -1814,7 +1814,7 @@
PassRefPtr<Attr> Element::setAttributeNode(Attr* attrNode, ExceptionState& es)
{
if (!attrNode) {
- es.throwDOMException(TypeMismatchError);
+ es.throwUninformativeAndGenericDOMException(TypeMismatchError);
return 0;
}
@@ -1825,7 +1825,7 @@
// InUseAttributeError: Raised if node is an Attr that is already an attribute of another Element object.
// The DOM user must explicitly clone Attr nodes to re-use them in other elements.
if (attrNode->ownerElement()) {
- es.throwDOMException(InUseAttributeError);
+ es.throwUninformativeAndGenericDOMException(InUseAttributeError);
return 0;
}
@@ -1833,7 +1833,7 @@
UniqueElementData* elementData = ensureUniqueElementData();
size_t index = elementData->getAttributeItemIndex(attrNode->qualifiedName(), shouldIgnoreAttributeCase(this));
- if (index != notFound) {
+ if (index != kNotFound) {
if (oldAttrNode)
detachAttrNodeFromElementWithValue(oldAttrNode.get(), elementData->attributeItem(index)->value());
else
@@ -1857,11 +1857,11 @@
PassRefPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionState& es)
{
if (!attr) {
- es.throwDOMException(TypeMismatchError);
+ es.throwUninformativeAndGenericDOMException(TypeMismatchError);
return 0;
}
if (attr->ownerElement() != this) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return 0;
}
@@ -1870,8 +1870,8 @@
synchronizeAttribute(attr->qualifiedName());
size_t index = elementData()->getAttrIndex(attr);
- if (index == notFound) {
- es.throwDOMException(NotFoundError);
+ if (index == kNotFound) {
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return 0;
}
@@ -1890,7 +1890,7 @@
QualifiedName qName(prefix, localName, namespaceURI);
if (!Document::hasValidNamespaceForAttributes(qName)) {
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
return false;
}
@@ -1945,7 +1945,7 @@
AtomicString localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
size_t index = elementData()->getAttributeItemIndex(localName, false);
- if (index == notFound) {
+ if (index == kNotFound) {
if (UNLIKELY(localName == styleAttr) && elementData()->m_styleAttributeIsDirty && isStyledElement())
removeAllInlineStyleProperties();
return;
@@ -2506,7 +2506,7 @@
bool Element::webkitMatchesSelector(const String& selector, ExceptionState& es)
{
if (selector.isEmpty()) {
- es.throwDOMException(SyntaxError);
+ es.throwUninformativeAndGenericDOMException(SyntaxError);
return false;
}
@@ -3611,7 +3611,7 @@
if (attributeItem(i)->name() == attr->qualifiedName())
return i;
}
- return notFound;
+ return kNotFound;
}
size_t ElementData::getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const
@@ -3630,7 +3630,7 @@
return i;
}
}
- return notFound;
+ return kNotFound;
}
Attribute* UniqueElementData::getAttributeItem(const QualifiedName& name)
diff --git a/Source/core/dom/Element.h b/Source/core/dom/Element.h
index a1bf613..9d1ad83 100644
--- a/Source/core/dom/Element.h
+++ b/Source/core/dom/Element.h
@@ -1035,7 +1035,7 @@
inline const Attribute* ElementData::getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const
{
size_t index = getAttributeItemIndex(name, shouldIgnoreAttributeCase);
- if (index != notFound)
+ if (index != kNotFound)
return attributeItem(index);
return 0;
}
@@ -1055,7 +1055,7 @@
if (attribute.name().matchesPossiblyIgnoringCase(name, shouldIgnoreCase))
return i;
}
- return notFound;
+ return kNotFound;
}
// We use a boolean parameter instead of calling shouldIgnoreAttributeCase so that the caller
@@ -1078,7 +1078,7 @@
if (doSlowCheck)
return getAttributeItemIndexSlowCase(name, shouldIgnoreAttributeCase);
- return notFound;
+ return kNotFound;
}
inline const Attribute* ElementData::getAttributeItem(const QualifiedName& name) const
diff --git a/Source/core/dom/ErrorEvent.cpp b/Source/core/dom/ErrorEvent.cpp
deleted file mode 100644
index dc15aec..0000000
--- a/Source/core/dom/ErrorEvent.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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 "core/dom/ErrorEvent.h"
-
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-ErrorEventInit::ErrorEventInit()
- : message()
- , filename()
- , lineno(0)
- , colno(0)
-{
-}
-
-ErrorEvent::ErrorEvent()
-{
- ScriptWrappable::init(this);
-}
-
-ErrorEvent::ErrorEvent(const AtomicString& type, const ErrorEventInit& initializer)
- : Event(type, initializer)
- , m_sanitizedMessage(initializer.message)
- , m_fileName(initializer.filename)
- , m_lineNumber(initializer.lineno)
- , m_columnNumber(initializer.colno)
- , m_world(DOMWrapperWorld::current())
-{
- ScriptWrappable::init(this);
-}
-
-ErrorEvent::ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, PassRefPtr<DOMWrapperWorld> world)
- : Event(eventNames().errorEvent, false, true)
- , m_sanitizedMessage(message)
- , m_fileName(fileName)
- , m_lineNumber(lineNumber)
- , m_columnNumber(columnNumber)
- , m_world(world)
-{
- ScriptWrappable::init(this);
-}
-
-void ErrorEvent::setUnsanitizedMessage(const String& message)
-{
- ASSERT(m_unsanitizedMessage.isEmpty());
- m_unsanitizedMessage = message;
-}
-
-ErrorEvent::~ErrorEvent()
-{
-}
-
-const AtomicString& ErrorEvent::interfaceName() const
-{
- return eventNames().interfaceForErrorEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/ErrorEvent.h b/Source/core/dom/ErrorEvent.h
deleted file mode 100644
index 34b8a42..0000000
--- a/Source/core/dom/ErrorEvent.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 ErrorEvent_h
-#define ErrorEvent_h
-
-#include "bindings/v8/DOMWrapperWorld.h"
-#include "core/dom/Event.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-struct ErrorEventInit : public EventInit {
- ErrorEventInit();
-
- String message;
- String filename;
- unsigned lineno;
- unsigned colno;
-};
-
-class ErrorEvent : public Event {
-public:
- static PassRefPtr<ErrorEvent> create()
- {
- return adoptRef(new ErrorEvent);
- }
- static PassRefPtr<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, PassRefPtr<DOMWrapperWorld> world)
- {
- return adoptRef(new ErrorEvent(message, fileName, lineNumber, columnNumber, world));
- }
- static PassRefPtr<ErrorEvent> create(const AtomicString& type, const ErrorEventInit& initializer)
- {
- return adoptRef(new ErrorEvent(type, initializer));
- }
- static PassRefPtr<ErrorEvent> createSanitizedError(PassRefPtr<DOMWrapperWorld> world)
- {
- return adoptRef(new ErrorEvent("Script error.", String(), 0, 0, world));
- }
- virtual ~ErrorEvent();
-
- // As 'message' is exposed to JavaScript, never return unsanitizedMessage.
- const String& message() const { return m_sanitizedMessage; }
- const String& filename() const { return m_fileName; }
- unsigned lineno() const { return m_lineNumber; }
- unsigned colno() const { return m_columnNumber; }
-
- // 'messageForConsole' is not exposed to JavaScript, and prefers 'm_unsanitizedMessage'.
- const String& messageForConsole() const { return !m_unsanitizedMessage.isEmpty() ? m_unsanitizedMessage : m_sanitizedMessage; }
-
- virtual const AtomicString& interfaceName() const;
-
- PassRefPtr<DOMWrapperWorld> world() const { return m_world; }
-
- void setUnsanitizedMessage(const String&);
-
-private:
- ErrorEvent();
- ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, PassRefPtr<DOMWrapperWorld>);
- ErrorEvent(const AtomicString&, const ErrorEventInit&);
-
- String m_unsanitizedMessage;
- String m_sanitizedMessage;
- String m_fileName;
- unsigned m_lineNumber;
- unsigned m_columnNumber;
-
- RefPtr<DOMWrapperWorld> m_world;
-};
-
-} // namespace WebCore
-
-#endif // ErrorEvent_h
diff --git a/Source/core/dom/ErrorEvent.idl b/Source/core/dom/ErrorEvent.idl
deleted file mode 100644
index 33f0239..0000000
--- a/Source/core/dom/ErrorEvent.idl
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-
-[
- ConstructorTemplate=Event
-] interface ErrorEvent : Event {
- [InitializedByEventConstructor] readonly attribute DOMString message;
- [InitializedByEventConstructor] readonly attribute DOMString filename;
- [InitializedByEventConstructor] readonly attribute unsigned long lineno;
- [InitializedByEventConstructor] readonly attribute unsigned long colno;
- [InitializedByEventConstructor, Custom, Unserializable] readonly attribute any error;
-};
-
diff --git a/Source/core/dom/Event.cpp b/Source/core/dom/Event.cpp
deleted file mode 100644
index 5b653df..0000000
--- a/Source/core/dom/Event.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/Event.h"
-
-#include "core/dom/EventNames.h"
-#include "core/dom/EventTarget.h"
-#include "core/dom/StaticNodeList.h"
-#include "wtf/CurrentTime.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-EventInit::EventInit()
- : bubbles(false)
- , cancelable(false)
-{
-}
-
-
-Event::Event()
- : m_canBubble(false)
- , m_cancelable(false)
- , m_propagationStopped(false)
- , m_immediatePropagationStopped(false)
- , m_defaultPrevented(false)
- , m_defaultHandled(false)
- , m_cancelBubble(false)
- , m_eventPhase(0)
- , m_currentTarget(0)
- , m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
-{
- ScriptWrappable::init(this);
-}
-
-Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg)
- : m_type(eventType)
- , m_canBubble(canBubbleArg)
- , m_cancelable(cancelableArg)
- , m_propagationStopped(false)
- , m_immediatePropagationStopped(false)
- , m_defaultPrevented(false)
- , m_defaultHandled(false)
- , m_cancelBubble(false)
- , m_eventPhase(0)
- , m_currentTarget(0)
- , m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
-{
- ScriptWrappable::init(this);
-}
-
-Event::Event(const AtomicString& eventType, const EventInit& initializer)
- : m_type(eventType)
- , m_canBubble(initializer.bubbles)
- , m_cancelable(initializer.cancelable)
- , m_propagationStopped(false)
- , m_immediatePropagationStopped(false)
- , m_defaultPrevented(false)
- , m_defaultHandled(false)
- , m_cancelBubble(false)
- , m_eventPhase(0)
- , m_currentTarget(0)
- , m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
-{
- ScriptWrappable::init(this);
-}
-
-Event::~Event()
-{
-}
-
-void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg)
-{
- if (dispatched())
- return;
-
- m_propagationStopped = false;
- m_immediatePropagationStopped = false;
- m_defaultPrevented = false;
-
- m_type = eventTypeArg;
- m_canBubble = canBubbleArg;
- m_cancelable = cancelableArg;
-}
-
-const AtomicString& Event::interfaceName() const
-{
- return eventNames().interfaceForEvent;
-}
-
-bool Event::hasInterface(const AtomicString& name) const
-{
- return interfaceName() == name;
-}
-
-bool Event::isUIEvent() const
-{
- return false;
-}
-
-bool Event::isMouseEvent() const
-{
- return false;
-}
-
-bool Event::isFocusEvent() const
-{
- return false;
-}
-
-bool Event::isKeyboardEvent() const
-{
- return false;
-}
-
-bool Event::isTouchEvent() const
-{
- return false;
-}
-
-bool Event::isDragEvent() const
-{
- return false;
-}
-
-bool Event::isClipboardEvent() const
-{
- return false;
-}
-
-bool Event::isBeforeTextInsertedEvent() const
-{
- return false;
-}
-
-bool Event::isBeforeUnloadEvent() const
-{
- return false;
-}
-
-void Event::setTarget(PassRefPtr<EventTarget> target)
-{
- if (m_target == target)
- return;
-
- m_target = target;
- if (m_target)
- receivedTarget();
-}
-
-void Event::receivedTarget()
-{
-}
-
-void Event::setUnderlyingEvent(PassRefPtr<Event> ue)
-{
- // Prohibit creation of a cycle -- just do nothing in that case.
- for (Event* e = ue.get(); e; e = e->underlyingEvent())
- if (e == this)
- return;
- m_underlyingEvent = ue;
-}
-
-PassRefPtr<NodeList> Event::path() const
-{
- if (!m_currentTarget || !m_currentTarget->toNode())
- return StaticNodeList::createEmpty();
- Node* node = m_currentTarget->toNode();
- size_t eventPathSize = m_eventPath.size();
- for (size_t i = 0; i < eventPathSize; ++i) {
- if (node == m_eventPath[i]->node()) {
- ASSERT(m_eventPath[i]->eventPath());
- return m_eventPath[i]->eventPath();
- }
- }
- return StaticNodeList::createEmpty();
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/Event.h b/Source/core/dom/Event.h
deleted file mode 100644
index 56dd5f9..0000000
--- a/Source/core/dom/Event.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef Event_h
-#define Event_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/DOMTimeStamp.h"
-#include "core/dom/EventContext.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-class Clipboard;
-class EventTarget;
-class EventDispatcher;
-class HTMLIFrameElement;
-
-struct EventInit {
- EventInit();
-
- bool bubbles;
- bool cancelable;
-};
-
-class Event : public ScriptWrappable, public RefCounted<Event> {
-public:
- enum PhaseType {
- NONE = 0,
- CAPTURING_PHASE = 1,
- AT_TARGET = 2,
- BUBBLING_PHASE = 3
- };
-
- enum EventType {
- MOUSEDOWN = 1,
- MOUSEUP = 2,
- MOUSEOVER = 4,
- MOUSEOUT = 8,
- MOUSEMOVE = 16,
- MOUSEDRAG = 32,
- CLICK = 64,
- DBLCLICK = 128,
- KEYDOWN = 256,
- KEYUP = 512,
- KEYPRESS = 1024,
- DRAGDROP = 2048,
- FOCUS = 4096,
- BLUR = 8192,
- SELECT = 16384,
- CHANGE = 32768
- };
-
- static PassRefPtr<Event> create()
- {
- return adoptRef(new Event);
- }
-
- // A factory for a simple event. The event doesn't bubble, and isn't
- // cancelable.
- // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#fire-a-simple-event
- static PassRefPtr<Event> create(const AtomicString& type)
- {
- return adoptRef(new Event(type, false, false));
- }
- static PassRefPtr<Event> createCancelable(const AtomicString& type)
- {
- return adoptRef(new Event(type, false, true));
- }
- static PassRefPtr<Event> createBubble(const AtomicString& type)
- {
- return adoptRef(new Event(type, true, false));
- }
- static PassRefPtr<Event> createCancelableBubble(const AtomicString& type)
- {
- return adoptRef(new Event(type, true, true));
- }
-
- static PassRefPtr<Event> create(const AtomicString& type, const EventInit& initializer)
- {
- return adoptRef(new Event(type, initializer));
- }
-
- virtual ~Event();
-
- void initEvent(const AtomicString& type, bool canBubble, bool cancelable);
-
- const AtomicString& type() const { return m_type; }
- void setType(const AtomicString& type) { m_type = type; }
-
- EventTarget* target() const { return m_target.get(); }
- void setTarget(PassRefPtr<EventTarget>);
-
- EventTarget* currentTarget() const { return m_currentTarget; }
- void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = currentTarget; }
-
- unsigned short eventPhase() const { return m_eventPhase; }
- void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; }
-
- bool bubbles() const { return m_canBubble; }
- bool cancelable() const { return m_cancelable; }
- DOMTimeStamp timeStamp() const { return m_createTime; }
-
- void stopPropagation() { m_propagationStopped = true; }
- void stopImmediatePropagation() { m_immediatePropagationStopped = true; }
-
- // IE Extensions
- EventTarget* srcElement() const { return target(); } // MSIE extension - "the object that fired the event"
-
- bool legacyReturnValue() const { return !defaultPrevented(); }
- void setLegacyReturnValue(bool returnValue) { setDefaultPrevented(!returnValue); }
-
- Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() : 0; }
-
- virtual const AtomicString& interfaceName() const;
- bool hasInterface(const AtomicString&) const;
-
- // These events are general classes of events.
- virtual bool isUIEvent() const;
- virtual bool isMouseEvent() const;
- virtual bool isFocusEvent() const;
- virtual bool isKeyboardEvent() const;
- virtual bool isTouchEvent() const;
-
- // Drag events are a subset of mouse events.
- virtual bool isDragEvent() const;
-
- // These events lack a DOM interface.
- virtual bool isClipboardEvent() const;
- virtual bool isBeforeTextInsertedEvent() const;
-
- virtual bool isBeforeUnloadEvent() const;
-
- bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; }
- bool immediatePropagationStopped() const { return m_immediatePropagationStopped; }
-
- bool defaultPrevented() const { return m_defaultPrevented; }
- void preventDefault()
- {
- if (m_cancelable)
- m_defaultPrevented = true;
- }
- void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defaultPrevented; }
-
- bool defaultHandled() const { return m_defaultHandled; }
- void setDefaultHandled() { m_defaultHandled = true; }
-
- bool cancelBubble() const { return m_cancelBubble; }
- void setCancelBubble(bool cancel) { m_cancelBubble = cancel; }
-
- Event* underlyingEvent() const { return m_underlyingEvent.get(); }
- void setUnderlyingEvent(PassRefPtr<Event>);
-
- EventPath& eventPath() { return m_eventPath; }
- PassRefPtr<NodeList> path() const;
-
- virtual Clipboard* clipboard() const { return 0; }
-
- bool isBeingDispatched() const { return eventPhase(); }
-
-protected:
- Event();
- Event(const AtomicString& type, bool canBubble, bool cancelable);
- Event(const AtomicString& type, const EventInit&);
-
- virtual void receivedTarget();
- bool dispatched() const { return m_target; }
-
-private:
- AtomicString m_type;
- bool m_canBubble;
- bool m_cancelable;
-
- bool m_propagationStopped;
- bool m_immediatePropagationStopped;
- bool m_defaultPrevented;
- bool m_defaultHandled;
- bool m_cancelBubble;
-
- unsigned short m_eventPhase;
- EventTarget* m_currentTarget;
- RefPtr<EventTarget> m_target;
- DOMTimeStamp m_createTime;
- RefPtr<Event> m_underlyingEvent;
- EventPath m_eventPath;
-};
-
-} // namespace WebCore
-
-#endif // Event_h
diff --git a/Source/core/dom/Event.idl b/Source/core/dom/Event.idl
deleted file mode 100644
index 88d704f..0000000
--- a/Source/core/dom/Event.idl
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-// Introduced in DOM Level 2:
-[
- CustomToV8,
- ConstructorTemplate=Event
-
-] interface Event {
-
- // DOM PhaseType
- const unsigned short NONE = 0;
- const unsigned short CAPTURING_PHASE = 1;
- const unsigned short AT_TARGET = 2;
- const unsigned short BUBBLING_PHASE = 3;
-
- // Reverse-engineered from Netscape
- const unsigned short MOUSEDOWN = 1;
- const unsigned short MOUSEUP = 2;
- const unsigned short MOUSEOVER = 4;
- const unsigned short MOUSEOUT = 8;
- const unsigned short MOUSEMOVE = 16;
- const unsigned short MOUSEDRAG = 32;
- const unsigned short CLICK = 64;
- const unsigned short DBLCLICK = 128;
- const unsigned short KEYDOWN = 256;
- const unsigned short KEYUP = 512;
- const unsigned short KEYPRESS = 1024;
- const unsigned short DRAGDROP = 2048;
- const unsigned short FOCUS = 4096;
- const unsigned short BLUR = 8192;
- const unsigned short SELECT = 16384;
- const unsigned short CHANGE = 32768;
-
- readonly attribute DOMString type;
- readonly attribute EventTarget target;
- readonly attribute EventTarget currentTarget;
- readonly attribute unsigned short eventPhase;
- [InitializedByEventConstructor] readonly attribute boolean bubbles;
- [InitializedByEventConstructor] readonly attribute boolean cancelable;
- readonly attribute DOMTimeStamp timeStamp;
-
- void stopPropagation();
- void preventDefault();
- void initEvent([Default=Undefined] optional DOMString eventTypeArg,
- [Default=Undefined] optional boolean canBubbleArg,
- [Default=Undefined] optional boolean cancelableArg);
-
- // DOM Level 3 Additions.
- readonly attribute boolean defaultPrevented;
- void stopImmediatePropagation();
-
- // IE Extensions
- readonly attribute EventTarget srcElement;
- [ImplementedAs=legacyReturnValue, DeprecateAs=EventReturnValue] attribute boolean returnValue;
- attribute boolean cancelBubble;
-
- [EnabledAtRuntime=ShadowDOM] readonly attribute NodeList path;
-
- [Custom] readonly attribute Clipboard clipboardData;
-};
-
diff --git a/Source/core/dom/EventAliases.in b/Source/core/dom/EventAliases.in
deleted file mode 100644
index a4b61c2..0000000
--- a/Source/core/dom/EventAliases.in
+++ /dev/null
@@ -1,14 +0,0 @@
-# Aliases
-AnimationEvent ImplementedAs=WebKitAnimationEvent, EnabledAtRuntime=cssAnimationUnprefixedEnabled
-Events ImplementedAs=Event
-HTMLEvents ImplementedAs=Event
-KeyboardEvents ImplementedAs=KeyboardEvent
-MouseEvents ImplementedAs=MouseEvent
-MutationEvents ImplementedAs=MutationEvent
-OrientationEvent ImplementedAs=Event, Conditional=ORIENTATION_EVENTS
-SVGEvents ImplementedAs=Event
-SVGZoomEvents ImplementedAs=SVGZoomEvent
-UIEvents ImplementedAs=UIEvent
-WebKitTransitionEvent ImplementedAs=TransitionEvent
-
-core/dom/TouchEvent EnabledAtRuntime=touchEnabled
diff --git a/Source/core/dom/EventContext.cpp b/Source/core/dom/EventContext.cpp
deleted file mode 100644
index b1d2fe8..0000000
--- a/Source/core/dom/EventContext.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 "core/dom/EventContext.h"
-
-#include "core/dom/Event.h"
-#include "core/dom/FocusEvent.h"
-#include "core/dom/MouseEvent.h"
-#include "core/dom/Node.h"
-#include "core/dom/StaticNodeList.h"
-#include "core/dom/TouchEvent.h"
-#include "core/dom/TouchList.h"
-
-namespace WebCore {
-
-EventContext::EventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget> currentTarget, PassRefPtr<EventTarget> target)
- : m_node(node)
- , m_currentTarget(currentTarget)
- , m_target(target)
-{
- ASSERT(m_node);
- ASSERT(!isUnreachableNode(m_target.get()));
-}
-
-EventContext::~EventContext()
-{
-}
-
-void EventContext::adoptEventPath(Vector<RefPtr<Node> >& nodes)
-{
- m_eventPath = StaticNodeList::adopt(nodes);
-}
-
-void EventContext::handleLocalEvents(Event* event) const
-{
- event->setTarget(m_target.get());
- event->setCurrentTarget(m_currentTarget.get());
- m_node->handleLocalEvents(event);
-}
-
-bool EventContext::isMouseOrFocusEventContext() const
-{
- return false;
-}
-
-bool EventContext::isTouchEventContext() const
-{
- return false;
-}
-
-MouseOrFocusEventContext::MouseOrFocusEventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget> currentTarget, PassRefPtr<EventTarget> target)
- : EventContext(node, currentTarget, target)
- , m_relatedTarget(0)
-{
-}
-
-MouseOrFocusEventContext::~MouseOrFocusEventContext()
-{
-}
-
-void MouseOrFocusEventContext::handleLocalEvents(Event* event) const
-{
- ASSERT(event->isMouseEvent() || event->isFocusEvent());
- if (m_relatedTarget.get() && event->isMouseEvent())
- toMouseEvent(event)->setRelatedTarget(m_relatedTarget.get());
- else if (m_relatedTarget.get() && event->isFocusEvent())
- toFocusEvent(event)->setRelatedTarget(m_relatedTarget.get());
- EventContext::handleLocalEvents(event);
-}
-
-bool MouseOrFocusEventContext::isMouseOrFocusEventContext() const
-{
- return true;
-}
-
-TouchEventContext::TouchEventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget> currentTarget, PassRefPtr<EventTarget> target)
- : EventContext(node, currentTarget, target)
- , m_touches(TouchList::create())
- , m_targetTouches(TouchList::create())
- , m_changedTouches(TouchList::create())
-{
-}
-
-TouchEventContext::~TouchEventContext()
-{
-}
-
-void TouchEventContext::handleLocalEvents(Event* event) const
-{
-#ifndef NDEBUG
- checkReachability(m_touches.get());
- checkReachability(m_targetTouches.get());
- checkReachability(m_changedTouches.get());
-#endif
- ASSERT(event->isTouchEvent());
- TouchEvent* touchEvent = toTouchEvent(event);
- touchEvent->setTouches(m_touches);
- touchEvent->setTargetTouches(m_targetTouches);
- touchEvent->setChangedTouches(m_changedTouches);
- EventContext::handleLocalEvents(event);
-}
-
-bool TouchEventContext::isTouchEventContext() const
-{
- return true;
-}
-
-#ifndef NDEBUG
-void TouchEventContext::checkReachability(TouchList* touchList) const
-{
- for (size_t i = 0; i < touchList->length(); ++i)
- ASSERT(touchList->item(i)->target()->toNode()->treeScope().isInclusiveAncestorOf(m_node->treeScope()));
-}
-#endif
-
-}
diff --git a/Source/core/dom/EventContext.h b/Source/core/dom/EventContext.h
deleted file mode 100644
index 748fff0..0000000
--- a/Source/core/dom/EventContext.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 EventContext_h
-#define EventContext_h
-
-#include "core/dom/EventTarget.h"
-#include "core/dom/Node.h"
-#include "core/dom/StaticNodeList.h"
-#include "core/dom/TreeScope.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class Event;
-class TouchList;
-
-class EventContext {
-public:
- // FIXME: Use ContainerNode instead of Node.
- EventContext(PassRefPtr<Node>, PassRefPtr<EventTarget> currentTarget, PassRefPtr<EventTarget> target);
- virtual ~EventContext();
-
- Node* node() const { return m_node.get(); }
- EventTarget* target() const { return m_target.get(); }
- PassRefPtr<NodeList> eventPath() { return m_eventPath; }
- void adoptEventPath(Vector<RefPtr<Node> >&);
- void setEventPath(PassRefPtr<NodeList> nodeList) { m_eventPath = nodeList; }
-
- bool currentTargetSameAsTarget() const { return m_currentTarget.get() == m_target.get(); }
- virtual void handleLocalEvents(Event*) const;
- virtual bool isMouseOrFocusEventContext() const;
- virtual bool isTouchEventContext() const;
-
-protected:
-#ifndef NDEBUG
- bool isUnreachableNode(EventTarget*);
-#endif
- RefPtr<Node> m_node;
- RefPtr<EventTarget> m_currentTarget;
- RefPtr<EventTarget> m_target;
- RefPtr<NodeList> m_eventPath;
-};
-
-typedef Vector<OwnPtr<EventContext>, 32> EventPath;
-
-class MouseOrFocusEventContext : public EventContext {
-public:
- MouseOrFocusEventContext(PassRefPtr<Node>, PassRefPtr<EventTarget> currentTarget, PassRefPtr<EventTarget> target);
- virtual ~MouseOrFocusEventContext();
- EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
- void setRelatedTarget(PassRefPtr<EventTarget>);
- virtual void handleLocalEvents(Event*) const OVERRIDE;
- virtual bool isMouseOrFocusEventContext() const OVERRIDE;
-
-private:
- RefPtr<EventTarget> m_relatedTarget;
-};
-
-
-class TouchEventContext : public EventContext {
-public:
- TouchEventContext(PassRefPtr<Node>, PassRefPtr<EventTarget> currentTarget, PassRefPtr<EventTarget> target);
- virtual ~TouchEventContext();
-
- virtual void handleLocalEvents(Event*) const OVERRIDE;
- virtual bool isTouchEventContext() const OVERRIDE;
-
- TouchList* touches() { return m_touches.get(); }
- TouchList* targetTouches() { return m_targetTouches.get(); }
- TouchList* changedTouches() { return m_changedTouches.get(); }
-
-private:
- RefPtr<TouchList> m_touches;
- RefPtr<TouchList> m_targetTouches;
- RefPtr<TouchList> m_changedTouches;
-#ifndef NDEBUG
- void checkReachability(TouchList*) const;
-#endif
-};
-
-inline TouchEventContext* toTouchEventContext(EventContext* eventContext)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(!eventContext || eventContext->isTouchEventContext());
- return static_cast<TouchEventContext*>(eventContext);
-}
-
-#ifndef NDEBUG
-inline bool EventContext::isUnreachableNode(EventTarget* target)
-{
- // FIXME: Checks also for SVG elements.
- return target && target->toNode() && !target->toNode()->isSVGElement() && !target->toNode()->treeScope().isInclusiveAncestorOf(m_node->treeScope());
-}
-#endif
-
-inline void MouseOrFocusEventContext::setRelatedTarget(PassRefPtr<EventTarget> relatedTarget)
-{
- ASSERT(!isUnreachableNode(relatedTarget.get()));
- m_relatedTarget = relatedTarget;
-}
-
-}
-
-#endif // EventContext_h
diff --git a/Source/core/dom/EventDispatchMediator.cpp b/Source/core/dom/EventDispatchMediator.cpp
deleted file mode 100644
index 45c9206..0000000
--- a/Source/core/dom/EventDispatchMediator.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/dom/EventDispatchMediator.h"
-
-#include "core/dom/Event.h"
-#include "core/dom/EventDispatcher.h"
-
-namespace WebCore {
-
-PassRefPtr<EventDispatchMediator> EventDispatchMediator::create(PassRefPtr<Event> event)
-{
- return adoptRef(new EventDispatchMediator(event));
-}
-
-EventDispatchMediator::EventDispatchMediator(PassRefPtr<Event> event)
- : m_event(event)
-{
-}
-
-bool EventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
- ASSERT(m_event.get() == dispatcher->event());
- return dispatcher->dispatch();
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/EventDispatchMediator.h b/Source/core/dom/EventDispatchMediator.h
deleted file mode 100644
index 00ab327..0000000
--- a/Source/core/dom/EventDispatchMediator.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EventDispatchMediator_h
-#define EventDispatchMediator_h
-
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class Event;
-class EventDispatcher;
-class Node;
-
-class EventDispatchMediator : public RefCounted<EventDispatchMediator> {
-public:
- static PassRefPtr<EventDispatchMediator> create(PassRefPtr<Event>);
- virtual ~EventDispatchMediator() { };
- virtual bool dispatchEvent(EventDispatcher*) const;
- Event* event() const { return m_event.get(); };
-
-protected:
- explicit EventDispatchMediator(PassRefPtr<Event>);
- EventDispatchMediator() { };
- void setEvent(PassRefPtr<Event> event) { m_event = event; };
-
-private:
- RefPtr<Event> m_event;
-};
-
-} // namespace WebCore
-
-#endif // EventDispatchMediator_h
diff --git a/Source/core/dom/EventDispatcher.cpp b/Source/core/dom/EventDispatcher.cpp
deleted file mode 100644
index 9bcfb11..0000000
--- a/Source/core/dom/EventDispatcher.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- * Copyright (C) 2011 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/EventDispatcher.h"
-
-#include "core/dom/ContainerNode.h"
-#include "core/dom/EventContext.h"
-#include "core/dom/EventDispatchMediator.h"
-#include "core/dom/EventRetargeter.h"
-#include "core/dom/MouseEvent.h"
-#include "core/dom/ScopedEventQueue.h"
-#include "core/dom/WindowEventContext.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/page/FrameView.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0;
-
-bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator> mediator)
-{
- ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
- if (!mediator->event())
- return true;
- EventDispatcher dispatcher(node, mediator->event());
- return mediator->dispatchEvent(&dispatcher);
-}
-
-EventDispatcher::EventDispatcher(Node* node, PassRefPtr<Event> event)
- : m_node(node)
- , m_event(event)
-#ifndef NDEBUG
- , m_eventDispatched(false)
-#endif
-{
- ASSERT(node);
- ASSERT(m_event.get());
- ASSERT(!m_event->type().isNull()); // JavaScript code can create an event with an empty name, but not null.
- m_view = node->document().view();
- EventRetargeter::ensureEventPath(m_node.get(), m_event.get());
-}
-
-void EventDispatcher::dispatchScopedEvent(Node* node, PassRefPtr<EventDispatchMediator> mediator)
-{
- // We need to set the target here because it can go away by the time we actually fire the event.
- mediator->event()->setTarget(EventRetargeter::eventTargetRespectingTargetRules(node));
- ScopedEventQueue::instance()->enqueueEventDispatchMediator(mediator);
-}
-
-void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions)
-{
- if (isDisabledFormControl(node))
- return;
-
- if (!gNodesDispatchingSimulatedClicks)
- gNodesDispatchingSimulatedClicks = new HashSet<Node*>;
- else if (gNodesDispatchingSimulatedClicks->contains(node))
- return;
-
- gNodesDispatchingSimulatedClicks->add(node);
-
- if (mouseEventOptions == SendMouseOverUpDownEvents)
- EventDispatcher(node, SimulatedMouseEvent::create(eventNames().mouseoverEvent, node->document().defaultView(), underlyingEvent)).dispatch();
-
- if (mouseEventOptions != SendNoEvents)
- EventDispatcher(node, SimulatedMouseEvent::create(eventNames().mousedownEvent, node->document().defaultView(), underlyingEvent)).dispatch();
- node->setActive(true, visualOptions == ShowPressedLook);
- if (mouseEventOptions != SendNoEvents)
- EventDispatcher(node, SimulatedMouseEvent::create(eventNames().mouseupEvent, node->document().defaultView(), underlyingEvent)).dispatch();
- node->setActive(false);
-
- // always send click
- EventDispatcher(node, SimulatedMouseEvent::create(eventNames().clickEvent, node->document().defaultView(), underlyingEvent)).dispatch();
-
- gNodesDispatchingSimulatedClicks->remove(node);
-}
-
-bool EventDispatcher::dispatch()
-{
-#ifndef NDEBUG
- ASSERT(!m_eventDispatched);
- m_eventDispatched = true;
-#endif
- ChildNodesLazySnapshot::takeChildNodesLazySnapshot();
-
- m_event->setTarget(EventRetargeter::eventTargetRespectingTargetRules(m_node.get()));
- ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
- ASSERT(m_event->target());
- WindowEventContext windowEventContext(m_event.get(), m_node.get(), topEventContext());
- InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(&m_node->document(), *m_event, windowEventContext.window(), m_node.get(), m_event->eventPath());
-
- void* preDispatchEventHandlerResult;
- if (dispatchEventPreProcess(preDispatchEventHandlerResult) == ContinueDispatching)
- if (dispatchEventAtCapturing(windowEventContext) == ContinueDispatching)
- if (dispatchEventAtTarget() == ContinueDispatching)
- dispatchEventAtBubbling(windowEventContext);
- dispatchEventPostProcess(preDispatchEventHandlerResult);
-
- // Ensure that after event dispatch, the event's target object is the
- // outermost shadow DOM boundary.
- m_event->setTarget(windowEventContext.target());
- m_event->setCurrentTarget(0);
- InspectorInstrumentation::didDispatchEvent(cookie);
-
- return !m_event->defaultPrevented();
-}
-
-inline EventDispatchContinuation EventDispatcher::dispatchEventPreProcess(void*& preDispatchEventHandlerResult)
-{
- // Give the target node a chance to do some work before DOM event handlers get a crack.
- preDispatchEventHandlerResult = m_node->preDispatchEventHandler(m_event.get());
- return (m_event->eventPath().isEmpty() || m_event->propagationStopped()) ? DoneDispatching : ContinueDispatching;
-}
-
-inline EventDispatchContinuation EventDispatcher::dispatchEventAtCapturing(WindowEventContext& windowEventContext)
-{
- // Trigger capturing event handlers, starting at the top and working our way down.
- m_event->setEventPhase(Event::CAPTURING_PHASE);
-
- if (windowEventContext.handleLocalEvents(m_event.get()) && m_event->propagationStopped())
- return DoneDispatching;
-
- for (size_t i = m_event->eventPath().size() - 1; i > 0; --i) {
- const EventContext& eventContext = *m_event->eventPath()[i];
- if (eventContext.currentTargetSameAsTarget())
- continue;
- eventContext.handleLocalEvents(m_event.get());
- if (m_event->propagationStopped())
- return DoneDispatching;
- }
-
- return ContinueDispatching;
-}
-
-inline EventDispatchContinuation EventDispatcher::dispatchEventAtTarget()
-{
- m_event->setEventPhase(Event::AT_TARGET);
- m_event->eventPath()[0]->handleLocalEvents(m_event.get());
- return m_event->propagationStopped() ? DoneDispatching : ContinueDispatching;
-}
-
-inline void EventDispatcher::dispatchEventAtBubbling(WindowEventContext& windowContext)
-{
- // Trigger bubbling event handlers, starting at the bottom and working our way up.
- size_t size = m_event->eventPath().size();
- for (size_t i = 1; i < size; ++i) {
- const EventContext& eventContext = *m_event->eventPath()[i];
- if (eventContext.currentTargetSameAsTarget())
- m_event->setEventPhase(Event::AT_TARGET);
- else if (m_event->bubbles() && !m_event->cancelBubble())
- m_event->setEventPhase(Event::BUBBLING_PHASE);
- else
- continue;
- eventContext.handleLocalEvents(m_event.get());
- if (m_event->propagationStopped())
- return;
- }
- if (m_event->bubbles() && !m_event->cancelBubble()) {
- m_event->setEventPhase(Event::BUBBLING_PHASE);
- windowContext.handleLocalEvents(m_event.get());
- }
-}
-
-inline void EventDispatcher::dispatchEventPostProcess(void* preDispatchEventHandlerResult)
-{
- m_event->setTarget(EventRetargeter::eventTargetRespectingTargetRules(m_node.get()));
- m_event->setCurrentTarget(0);
- m_event->setEventPhase(0);
-
- // Pass the data from the preDispatchEventHandler to the postDispatchEventHandler.
- m_node->postDispatchEventHandler(m_event.get(), preDispatchEventHandlerResult);
-
- // Call default event handlers. While the DOM does have a concept of preventing
- // default handling, the detail of which handlers are called is an internal
- // implementation detail and not part of the DOM.
- if (!m_event->defaultPrevented() && !m_event->defaultHandled()) {
- // Non-bubbling events call only one default event handler, the one for the target.
- m_node->willCallDefaultEventHandler(*m_event);
- m_node->defaultEventHandler(m_event.get());
- ASSERT(!m_event->defaultPrevented());
- if (m_event->defaultHandled())
- return;
- // For bubbling events, call default event handlers on the same targets in the
- // same order as the bubbling phase.
- if (m_event->bubbles()) {
- size_t size = m_event->eventPath().size();
- for (size_t i = 1; i < size; ++i) {
- m_event->eventPath()[i]->node()->willCallDefaultEventHandler(*m_event);
- m_event->eventPath()[i]->node()->defaultEventHandler(m_event.get());
- ASSERT(!m_event->defaultPrevented());
- if (m_event->defaultHandled())
- return;
- }
- }
- }
-}
-
-const EventContext* EventDispatcher::topEventContext()
-{
- return m_event->eventPath().isEmpty() ? 0 : m_event->eventPath().last().get();
-}
-
-}
diff --git a/Source/core/dom/EventDispatcher.h b/Source/core/dom/EventDispatcher.h
deleted file mode 100644
index 5587132..0000000
--- a/Source/core/dom/EventDispatcher.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- * Copyright (C) 2011 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef EventDispatcher_h
-#define EventDispatcher_h
-
-#include "core/dom/EventContext.h"
-#include "core/dom/SimulatedClickOptions.h"
-#include "wtf/Forward.h"
-#include "wtf/PassRefPtr.h"
-
-namespace WebCore {
-
-class Event;
-class EventDispatchMediator;
-class EventTarget;
-class FrameView;
-class Node;
-class PlatformKeyboardEvent;
-class PlatformMouseEvent;
-class ShadowRoot;
-class TreeScope;
-class WindowEventContext;
-
-enum EventDispatchContinuation {
- ContinueDispatching,
- DoneDispatching
-};
-
-class EventDispatcher {
-public:
- static bool dispatchEvent(Node*, PassRefPtr<EventDispatchMediator>);
- static void dispatchScopedEvent(Node*, PassRefPtr<EventDispatchMediator>);
-
- static void dispatchSimulatedClick(Node*, Event* underlyingEvent, SimulatedClickMouseEventOptions, SimulatedClickVisualOptions);
-
- bool dispatch();
- Node* node() const { return m_node.get(); }
- Event* event() const { return m_event.get(); }
-
-private:
- EventDispatcher(Node*, PassRefPtr<Event>);
- const EventContext* topEventContext();
-
- EventDispatchContinuation dispatchEventPreProcess(void*& preDispatchEventHandlerResult);
- EventDispatchContinuation dispatchEventAtCapturing(WindowEventContext&);
- EventDispatchContinuation dispatchEventAtTarget();
- void dispatchEventAtBubbling(WindowEventContext&);
- void dispatchEventPostProcess(void* preDispatchEventHandlerResult);
-
- RefPtr<Node> m_node;
- RefPtr<Event> m_event;
- RefPtr<FrameView> m_view;
-#ifndef NDEBUG
- bool m_eventDispatched;
-#endif
-};
-
-}
-
-#endif
diff --git a/Source/core/dom/EventFactory.h b/Source/core/dom/EventFactory.h
deleted file mode 100644
index 2436e3f..0000000
--- a/Source/core/dom/EventFactory.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2011 Google, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EventFactory_h
-#define EventFactory_h
-
-#include "wtf/PassRefPtr.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-class Event;
-
-class EventFactory {
-public:
- static PassRefPtr<Event> create(const String& eventType);
-};
-
-}
-
-#endif
diff --git a/Source/core/dom/EventListener.h b/Source/core/dom/EventListener.h
deleted file mode 100644
index cb4eaa0..0000000
--- a/Source/core/dom/EventListener.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2006, 2008, 2009 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef EventListener_h
-#define EventListener_h
-
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
- class DOMWrapperWorld;
- class Event;
- class ScriptExecutionContext;
-
- class EventListener : public RefCounted<EventListener> {
- public:
- enum Type {
- JSEventListenerType,
- ImageEventListenerType,
- ObjCEventListenerType,
- CPPEventListenerType,
- ConditionEventListenerType,
- GObjectEventListenerType,
- NativeEventListenerType,
- };
-
- virtual ~EventListener() { }
- virtual bool operator==(const EventListener&) = 0;
- virtual void handleEvent(ScriptExecutionContext*, Event*) = 0;
- virtual bool wasCreatedFromMarkup() const { return false; }
- virtual DOMWrapperWorld* world() const { return 0; }
-
- bool isAttribute() const { return virtualisAttribute(); }
- Type type() const { return m_type; }
-
- protected:
- explicit EventListener(Type type)
- : m_type(type)
- {
- }
-
- private:
- virtual bool virtualisAttribute() const { return false; }
-
- Type m_type;
- };
-
-}
-
-#endif
diff --git a/Source/core/dom/EventListener.idl b/Source/core/dom/EventListener.idl
deleted file mode 100644
index fc4b8bc..0000000
--- a/Source/core/dom/EventListener.idl
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-callback interface EventListener {
- void handleEvent(Event event);
-};
-
diff --git a/Source/core/dom/EventListenerMap.cpp b/Source/core/dom/EventListenerMap.cpp
deleted file mode 100644
index 35af02f..0000000
--- a/Source/core/dom/EventListenerMap.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2011 Andreas Kling (kling@webkit.org)
- *
- * 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 "core/dom/EventListenerMap.h"
-
-#include "core/dom/EventTarget.h"
-#include "wtf/StdLibExtras.h"
-#include "wtf/Vector.h"
-
-#ifndef NDEBUG
-#include "wtf/ThreadingPrimitives.h"
-#endif
-
-using namespace WTF;
-
-namespace WebCore {
-
-#ifndef NDEBUG
-static Mutex& activeIteratorCountMutex()
-{
- DEFINE_STATIC_LOCAL(Mutex, mutex, ());
- return mutex;
-}
-
-void EventListenerMap::assertNoActiveIterators()
-{
- MutexLocker locker(activeIteratorCountMutex());
- ASSERT(!m_activeIteratorCount);
-}
-#endif
-
-EventListenerMap::EventListenerMap()
-#ifndef NDEBUG
- : m_activeIteratorCount(0)
-#endif
-{
-}
-
-bool EventListenerMap::contains(const AtomicString& eventType) const
-{
- for (unsigned i = 0; i < m_entries.size(); ++i) {
- if (m_entries[i].first == eventType)
- return true;
- }
- return false;
-}
-
-bool EventListenerMap::containsCapturing(const AtomicString& eventType) const
-{
- for (unsigned i = 0; i < m_entries.size(); ++i) {
- if (m_entries[i].first == eventType) {
- const EventListenerVector* vector = m_entries[i].second.get();
- for (unsigned j = 0; j < vector->size(); ++j) {
- if (vector->at(j).useCapture)
- return true;
- }
- }
- }
- return false;
-}
-
-void EventListenerMap::clear()
-{
- assertNoActiveIterators();
-
- m_entries.clear();
-}
-
-Vector<AtomicString> EventListenerMap::eventTypes() const
-{
- Vector<AtomicString> types;
- types.reserveInitialCapacity(m_entries.size());
-
- for (unsigned i = 0; i < m_entries.size(); ++i)
- types.uncheckedAppend(m_entries[i].first);
-
- return types;
-}
-
-static bool addListenerToVector(EventListenerVector* vector, PassRefPtr<EventListener> listener, bool useCapture)
-{
- RegisteredEventListener registeredListener(listener, useCapture);
-
- if (vector->find(registeredListener) != notFound)
- return false; // Duplicate listener.
-
- vector->append(registeredListener);
- return true;
-}
-
-bool EventListenerMap::add(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
-{
- assertNoActiveIterators();
-
- for (unsigned i = 0; i < m_entries.size(); ++i) {
- if (m_entries[i].first == eventType)
- return addListenerToVector(m_entries[i].second.get(), listener, useCapture);
- }
-
- m_entries.append(std::make_pair(eventType, adoptPtr(new EventListenerVector)));
- return addListenerToVector(m_entries.last().second.get(), listener, useCapture);
-}
-
-static bool removeListenerFromVector(EventListenerVector* listenerVector, EventListener* listener, bool useCapture, size_t& indexOfRemovedListener)
-{
- RegisteredEventListener registeredListener(listener, useCapture);
- indexOfRemovedListener = listenerVector->find(registeredListener);
- if (indexOfRemovedListener == notFound)
- return false;
- listenerVector->remove(indexOfRemovedListener);
- return true;
-}
-
-bool EventListenerMap::remove(const AtomicString& eventType, EventListener* listener, bool useCapture, size_t& indexOfRemovedListener)
-{
- assertNoActiveIterators();
-
- for (unsigned i = 0; i < m_entries.size(); ++i) {
- if (m_entries[i].first == eventType) {
- bool wasRemoved = removeListenerFromVector(m_entries[i].second.get(), listener, useCapture, indexOfRemovedListener);
- if (m_entries[i].second->isEmpty())
- m_entries.remove(i);
- return wasRemoved;
- }
- }
-
- return false;
-}
-
-EventListenerVector* EventListenerMap::find(const AtomicString& eventType)
-{
- assertNoActiveIterators();
-
- for (unsigned i = 0; i < m_entries.size(); ++i) {
- if (m_entries[i].first == eventType)
- return m_entries[i].second.get();
- }
-
- return 0;
-}
-
-static void removeFirstListenerCreatedFromMarkup(EventListenerVector* listenerVector)
-{
- bool foundListener = false;
-
- for (size_t i = 0; i < listenerVector->size(); ++i) {
- if (!listenerVector->at(i).listener->wasCreatedFromMarkup())
- continue;
- foundListener = true;
- listenerVector->remove(i);
- break;
- }
-
- ASSERT_UNUSED(foundListener, foundListener);
-}
-
-void EventListenerMap::removeFirstEventListenerCreatedFromMarkup(const AtomicString& eventType)
-{
- assertNoActiveIterators();
-
- for (unsigned i = 0; i < m_entries.size(); ++i) {
- if (m_entries[i].first == eventType) {
- removeFirstListenerCreatedFromMarkup(m_entries[i].second.get());
- if (m_entries[i].second->isEmpty())
- m_entries.remove(i);
- return;
- }
- }
-}
-
-static void copyListenersNotCreatedFromMarkupToTarget(const AtomicString& eventType, EventListenerVector* listenerVector, EventTarget* target)
-{
- for (size_t i = 0; i < listenerVector->size(); ++i) {
- // Event listeners created from markup have already been transfered to the shadow tree during cloning.
- if ((*listenerVector)[i].listener->wasCreatedFromMarkup())
- continue;
- target->addEventListener(eventType, (*listenerVector)[i].listener, (*listenerVector)[i].useCapture);
- }
-}
-
-void EventListenerMap::copyEventListenersNotCreatedFromMarkupToTarget(EventTarget* target)
-{
- assertNoActiveIterators();
-
- for (unsigned i = 0; i < m_entries.size(); ++i)
- copyListenersNotCreatedFromMarkupToTarget(m_entries[i].first, m_entries[i].second.get(), target);
-}
-
-EventListenerIterator::EventListenerIterator()
- : m_map(0)
- , m_entryIndex(0)
- , m_index(0)
-{
-}
-
-EventListenerIterator::EventListenerIterator(EventTarget* target)
- : m_map(0)
- , m_entryIndex(0)
- , m_index(0)
-{
- ASSERT(target);
- EventTargetData* data = target->eventTargetData();
-
- if (!data)
- return;
-
- m_map = &data->eventListenerMap;
-
-#ifndef NDEBUG
- {
- MutexLocker locker(activeIteratorCountMutex());
- m_map->m_activeIteratorCount++;
- }
-#endif
-}
-
-#ifndef NDEBUG
-EventListenerIterator::~EventListenerIterator()
-{
- if (m_map) {
- MutexLocker locker(activeIteratorCountMutex());
- m_map->m_activeIteratorCount--;
- }
-}
-#endif
-
-EventListener* EventListenerIterator::nextListener()
-{
- if (!m_map)
- return 0;
-
- for (; m_entryIndex < m_map->m_entries.size(); ++m_entryIndex) {
- EventListenerVector& listeners = *m_map->m_entries[m_entryIndex].second;
- if (m_index < listeners.size())
- return listeners[m_index++].listener.get();
- m_index = 0;
- }
-
- return 0;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/EventListenerMap.h b/Source/core/dom/EventListenerMap.h
deleted file mode 100644
index 4889d94..0000000
--- a/Source/core/dom/EventListenerMap.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2011 Andreas Kling (kling@webkit.org)
- *
- * 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 EventListenerMap_h
-#define EventListenerMap_h
-
-#include "core/dom/RegisteredEventListener.h"
-#include "wtf/Forward.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/text/AtomicStringHash.h"
-
-namespace WebCore {
-
-class EventTarget;
-
-typedef Vector<RegisteredEventListener, 1> EventListenerVector;
-
-class EventListenerMap {
-public:
- EventListenerMap();
-
- bool isEmpty() const { return m_entries.isEmpty(); }
- bool contains(const AtomicString& eventType) const;
- bool containsCapturing(const AtomicString& eventType) const;
-
- void clear();
- bool add(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
- bool remove(const AtomicString& eventType, EventListener*, bool useCapture, size_t& indexOfRemovedListener);
- EventListenerVector* find(const AtomicString& eventType);
- Vector<AtomicString> eventTypes() const;
-
- void removeFirstEventListenerCreatedFromMarkup(const AtomicString& eventType);
- void copyEventListenersNotCreatedFromMarkupToTarget(EventTarget*);
-
-private:
- friend class EventListenerIterator;
-
- void assertNoActiveIterators();
-
- Vector<std::pair<AtomicString, OwnPtr<EventListenerVector> >, 2> m_entries;
-
-#ifndef NDEBUG
- int m_activeIteratorCount;
-#endif
-};
-
-class EventListenerIterator {
- WTF_MAKE_NONCOPYABLE(EventListenerIterator);
-public:
- EventListenerIterator();
- EventListenerIterator(EventTarget*);
-#ifndef NDEBUG
- ~EventListenerIterator();
-#endif
-
- EventListener* nextListener();
-
-private:
- EventListenerMap* m_map;
- unsigned m_entryIndex;
- unsigned m_index;
-};
-
-#ifdef NDEBUG
-inline void EventListenerMap::assertNoActiveIterators() { }
-#endif
-
-} // namespace WebCore
-
-#endif // EventListenerMap_h
diff --git a/Source/core/dom/EventNames.cpp b/Source/core/dom/EventNames.cpp
deleted file mode 100644
index 9821d03..0000000
--- a/Source/core/dom/EventNames.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-#define INITIALIZE_EVENT_NAME(name) \
- , name##Event(#name, AtomicString::ConstructFromLiteral)
-
-#define INITIALIZE_EVENT_INTERFACE(name) \
- , interfaceFor##name(#name, AtomicString::ConstructFromLiteral)
-
-EventNames::EventNames()
- : dummy(0)
-EVENT_NAMES_FOR_EACH(INITIALIZE_EVENT_NAME)
-EVENT_INTERFACES_FOR_EACH(INITIALIZE_EVENT_INTERFACE)
-EVENT_TARGET_INTERFACES_FOR_EACH(INITIALIZE_EVENT_INTERFACE)
-{
-}
-
-}
diff --git a/Source/core/dom/EventNames.h b/Source/core/dom/EventNames.h
deleted file mode 100644
index 225727d..0000000
--- a/Source/core/dom/EventNames.h
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Jon Shier (jshier@iastate.edu)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef EventNames_h
-#define EventNames_h
-
-#include "EventInterfaces.h"
-#include "EventTargetInterfaces.h"
-#include "core/platform/ThreadGlobalData.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-#define EVENT_NAMES_FOR_EACH(macro) \
- \
- macro(abort) \
- macro(beforecopy) \
- macro(beforecut) \
- macro(beforeload) \
- macro(beforepaste) \
- macro(beforeunload) \
- macro(blocked) \
- macro(blur) \
- macro(cached) \
- macro(cancel) \
- macro(change) \
- macro(chargingchange) \
- macro(chargingtimechange) \
- macro(checking) \
- macro(click) \
- macro(close) \
- macro(complete) \
- macro(compositionend) \
- macro(compositionstart) \
- macro(compositionupdate) \
- macro(connect) \
- macro(contextmenu) \
- macro(copy) \
- macro(cut) \
- macro(dblclick) \
- macro(devicemotion) \
- macro(deviceorientation) \
- macro(dischargingtimechange) \
- macro(disconnect) \
- macro(display) \
- macro(downloading) \
- macro(drag) \
- macro(dragend) \
- macro(dragenter) \
- macro(dragleave) \
- macro(dragover) \
- macro(dragstart) \
- macro(drop) \
- macro(error) \
- macro(focus) \
- macro(focusin) \
- macro(focusout) \
- macro(gesturetap) \
- macro(gesturetapunconfirmed) \
- macro(gesturetapdown) \
- macro(gesturescrollstart) \
- macro(gesturescrollend) \
- macro(gesturescrollupdate) \
- macro(hashchange) \
- macro(input) \
- macro(invalid) \
- macro(keydown) \
- macro(keypress) \
- macro(keyup) \
- macro(levelchange) \
- macro(load) \
- macro(loading) \
- macro(loadingdone) \
- macro(loadingerror) \
- macro(loadstart) \
- macro(message) \
- macro(midimessage) \
- macro(mousedown) \
- macro(mouseenter) \
- macro(mouseleave) \
- macro(mousemove) \
- macro(mouseout) \
- macro(mouseover) \
- macro(mouseup) \
- macro(mousewheel) \
- macro(noupdate) \
- macro(obsolete) \
- macro(offline) \
- macro(online) \
- macro(open) \
- macro(overflowchanged) \
- macro(pagehide) \
- macro(pageshow) \
- macro(paste) \
- macro(popstate) \
- macro(readystatechange) \
- macro(reset) \
- macro(resize) \
- macro(scroll) \
- macro(search) \
- macro(select) \
- macro(selectstart) \
- macro(selectionchange) \
- macro(storage) \
- macro(submit) \
- macro(textInput) \
- macro(unload) \
- macro(updateready) \
- macro(upgradeneeded) \
- macro(versionchange) \
- macro(webkitvisibilitychange) \
- macro(wheel) \
- macro(write) \
- macro(writeend) \
- macro(writestart) \
- macro(zoom) \
- \
- macro(DOMActivate) \
- macro(DOMFocusIn) \
- macro(DOMFocusOut) \
- macro(DOMCharacterDataModified) \
- macro(DOMNodeInserted) \
- macro(DOMNodeInsertedIntoDocument) \
- macro(DOMNodeRemoved) \
- macro(DOMNodeRemovedFromDocument) \
- macro(DOMSubtreeModified) \
- macro(DOMContentLoaded) \
- \
- macro(webkitBeforeTextInserted) \
- macro(webkitEditableContentChanged) \
- \
- macro(canplay) \
- macro(canplaythrough) \
- macro(durationchange) \
- macro(emptied) \
- macro(ended) \
- macro(loadeddata) \
- macro(loadedmetadata) \
- macro(pause) \
- macro(play) \
- macro(playing) \
- macro(ratechange) \
- macro(seeked) \
- macro(seeking) \
- macro(timeupdate) \
- macro(volumechange) \
- macro(waiting) \
- \
- macro(addtrack) \
- macro(cuechange) \
- macro(enter) \
- macro(exit) \
- \
- macro(addsourcebuffer) \
- macro(removesourcebuffer) \
- macro(sourceopen) \
- macro(sourceended) \
- macro(sourceclose) \
- macro(update) \
- macro(updateend) \
- macro(updatestart) \
- macro(webkitaddsourcebuffer) \
- macro(webkitremovesourcebuffer) \
- macro(webkitsourceopen) \
- macro(webkitsourceended) \
- macro(webkitsourceclose) \
- \
- macro(webkitkeyadded) \
- macro(webkitkeyerror) \
- macro(webkitkeymessage) \
- macro(webkitneedkey) \
- \
- macro(progress) \
- macro(stalled) \
- macro(suspend) \
- \
- macro(animationend) \
- macro(webkitAnimationEnd) \
- macro(animationstart) \
- macro(webkitAnimationStart) \
- macro(animationiteration) \
- macro(webkitAnimationIteration) \
- \
- macro(webkitTransitionEnd) \
- macro(transitionend) \
- \
- macro(orientationchange) \
- \
- macro(timeout) \
- \
- macro(touchstart) \
- macro(touchmove) \
- macro(touchend) \
- macro(touchcancel) \
- \
- macro(success) \
- \
- macro(loadend) \
- \
- macro(webkitfullscreenchange) \
- macro(webkitfullscreenerror) \
- \
- macro(webkitspeechchange) \
- \
- macro(audiostart) \
- macro(soundstart) \
- macro(speechstart) \
- macro(speechend) \
- macro(soundend) \
- macro(audioend) \
- macro(result) \
- macro(nomatch) \
- macro(start) \
- macro(end) \
- macro(mark) \
- macro(boundary) \
- macro(resume) \
- \
- macro(webglcontextlost) \
- macro(webglcontextrestored) \
- macro(webglcontextcreationerror) \
- \
- macro(audioprocess) \
- \
- macro(connecting) \
- macro(addstream) \
- macro(removestream) \
- macro(signalingstatechange) \
- macro(removetrack) \
- macro(mute) \
- macro(unmute) \
- macro(iceconnectionstatechange) \
- macro(icecandidate) \
- macro(negotiationneeded) \
- macro(datachannel) \
- macro(tonechange) \
- \
- macro(show) \
- \
- macro(webkitpointerlockchange) \
- macro(webkitpointerlockerror) \
- \
- macro(webkitregionlayoutupdate) \
- \
- macro(webkitregionoversetchange) \
- \
- macro(webkitnetworkinfochange) \
- \
- macro(webkitresourcetimingbufferfull) \
- \
- macro(webkitdeviceproximity) \
- \
- macro(autocomplete) \
- macro(autocompleteerror) \
- \
- macro(webkitprerenderstart) \
- macro(webkitprerenderstop) \
- macro(webkitprerenderload) \
- macro(webkitprerenderdomcontentloaded) \
- \
- macro(securitypolicyviolation) \
- \
-
-// end of EVENT_NAMES_FOR_EACH
-
- class EventNames {
- WTF_MAKE_NONCOPYABLE(EventNames); WTF_MAKE_FAST_ALLOCATED;
- int dummy; // Needed to make initialization macro work.
- // Private to prevent accidental call to EventNames() instead of eventNames()
- EventNames();
- friend class ThreadGlobalData;
-
- public:
- #define EVENT_NAMES_DECLARE(name) AtomicString name##Event;
- EVENT_NAMES_FOR_EACH(EVENT_NAMES_DECLARE)
- #undef EVENT_NAMES_DECLARE
-
- #define EVENT_INTERFACE_DECLARE(name) AtomicString interfaceFor##name;
- EVENT_INTERFACES_FOR_EACH(EVENT_INTERFACE_DECLARE)
- EVENT_TARGET_INTERFACES_FOR_EACH(EVENT_INTERFACE_DECLARE)
- #undef EVENT_INTERFACE_DECLARE
-
- inline bool isTouchEventType(const AtomicString& eventType) const
- {
- return eventType == touchstartEvent
- || eventType == touchmoveEvent
- || eventType == touchendEvent
- || eventType == touchcancelEvent;
- }
-
- inline bool isGestureEventType(const AtomicString& eventType) const
- {
- return eventType == gesturetapEvent
- || eventType == gesturetapunconfirmedEvent
- || eventType == gesturetapdownEvent
- || eventType == gesturescrollstartEvent
- || eventType == gesturescrollendEvent
- || eventType == gesturescrollupdateEvent;
- }
-
- Vector<AtomicString> touchEventNames() const
- {
- Vector<AtomicString> names;
- names.reserveCapacity(4);
- names.append(touchstartEvent);
- names.append(touchmoveEvent);
- names.append(touchendEvent);
- names.append(touchcancelEvent);
- return names;
- }
- };
-
- inline EventNames& eventNames()
- {
- return threadGlobalData().eventNames();
- }
-
-}
-
-#endif
diff --git a/Source/core/dom/EventPathWalker.cpp b/Source/core/dom/EventPathWalker.cpp
deleted file mode 100644
index aea6933..0000000
--- a/Source/core/dom/EventPathWalker.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- * * 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 "core/dom/EventPathWalker.h"
-
-#include "core/dom/shadow/ElementShadow.h"
-#include "core/dom/shadow/InsertionPoint.h"
-#include "core/dom/shadow/ShadowRoot.h"
-
-namespace WebCore {
-
-EventPathWalker::EventPathWalker(const Node* node)
- : m_node(node)
- , m_distributedNode(node)
- , m_isVisitingInsertionPointInReprojection(false)
-{
- ASSERT(node);
- node->document().updateDistributionForNodeIfNeeded(const_cast<Node*>(node));
-}
-
-Node* EventPathWalker::parent(const Node* node)
-{
- EventPathWalker walker(node);
- walker.moveToParent();
- return walker.node();
-}
-
-void EventPathWalker::moveToParent()
-{
- ASSERT(m_node);
- ASSERT(m_distributedNode);
- if (ElementShadow* shadow = shadowOfParent(m_node)) {
- if (InsertionPoint* insertionPoint = shadow->findInsertionPointFor(m_distributedNode)) {
- m_node = insertionPoint;
- m_isVisitingInsertionPointInReprojection = true;
- return;
- }
- }
- if (!m_node->isShadowRoot()) {
- m_node = m_node->parentNode();
- if (!(m_node && m_node->isShadowRoot() && toShadowRoot(m_node)->insertionPoint()))
- m_distributedNode = m_node;
- m_isVisitingInsertionPointInReprojection = false;
- return;
- }
-
- const ShadowRoot* shadowRoot = toShadowRoot(m_node);
- if (InsertionPoint* insertionPoint = shadowRoot->insertionPoint()) {
- m_node = insertionPoint;
- m_isVisitingInsertionPointInReprojection = true;
- return;
- }
- m_node = shadowRoot->host();
- m_distributedNode = m_node;
- m_isVisitingInsertionPointInReprojection = false;
-}
-
-} // namespace
diff --git a/Source/core/dom/EventPathWalker.h b/Source/core/dom/EventPathWalker.h
deleted file mode 100644
index 9006e9b..0000000
--- a/Source/core/dom/EventPathWalker.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- * * 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 EventPathWalker_h
-#define EventPathWalker_h
-
-namespace WebCore {
-
-class Node;
-
-class EventPathWalker {
-public:
- explicit EventPathWalker(const Node*);
- static Node* parent(const Node*);
- void moveToParent();
- Node* node() const { return const_cast<Node*>(m_node); }
- bool isVisitingInsertionPointInReprojection() { return m_isVisitingInsertionPointInReprojection; }
-
-private:
- const Node* m_node;
- const Node* m_distributedNode;
- bool m_isVisitingInsertionPointInReprojection;
-};
-
-} // namespace
-
-#endif
diff --git a/Source/core/dom/EventQueue.h b/Source/core/dom/EventQueue.h
deleted file mode 100644
index 770ae79..0000000
--- a/Source/core/dom/EventQueue.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 EventQueue_h
-#define EventQueue_h
-
-#include "wtf/HashMap.h"
-#include "wtf/HashSet.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebCore {
-
-class Event;
-
-class EventQueue {
-public:
- virtual ~EventQueue() { }
- virtual bool enqueueEvent(PassRefPtr<Event>) = 0;
- virtual bool cancelEvent(Event*) = 0;
- // The accumulated and all the future events will be discarded, no events will be dispatched anymore.
- virtual void close() = 0;
-};
-
-}
-
-#endif // EventQueue_h
diff --git a/Source/core/dom/EventRetargeter.cpp b/Source/core/dom/EventRetargeter.cpp
deleted file mode 100644
index da3e829..0000000
--- a/Source/core/dom/EventRetargeter.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright (C) 2013 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/EventRetargeter.h"
-
-#include "RuntimeEnabledFeatures.h"
-#include "core/dom/ContainerNode.h"
-#include "core/dom/EventContext.h"
-#include "core/dom/EventPathWalker.h"
-#include "core/dom/FocusEvent.h"
-#include "core/dom/FullscreenElementStack.h"
-#include "core/dom/MouseEvent.h"
-#include "core/dom/Touch.h"
-#include "core/dom/TouchEvent.h"
-#include "core/dom/TouchList.h"
-#include "core/dom/TreeScope.h"
-#include "core/dom/shadow/ShadowRoot.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-static inline bool inTheSameScope(ShadowRoot* shadowRoot, EventTarget* target)
-{
- return target->toNode() && target->toNode()->treeScope().rootNode() == shadowRoot;
-}
-
-static inline EventDispatchBehavior determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot, EventTarget* target)
-{
- // Video-only full screen is a mode where we use the shadow DOM as an implementation
- // detail that should not be detectable by the web content.
- if (Element* element = FullscreenElementStack::currentFullScreenElementFrom(&target->toNode()->document())) {
- // FIXME: We assume that if the full screen element is a media element that it's
- // the video-only full screen. Both here and elsewhere. But that is probably wrong.
- if (element->isMediaElement() && shadowRoot && shadowRoot->host() == element)
- return StayInsideShadowDOM;
- }
-
- // WebKit never allowed selectstart event to cross the the shadow DOM boundary.
- // Changing this breaks existing sites.
- // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details.
- const AtomicString eventType = event->type();
- if (inTheSameScope(shadowRoot, target)
- && (eventType == eventNames().abortEvent
- || eventType == eventNames().changeEvent
- || eventType == eventNames().errorEvent
- || eventType == eventNames().loadEvent
- || eventType == eventNames().resetEvent
- || eventType == eventNames().resizeEvent
- || eventType == eventNames().scrollEvent
- || eventType == eventNames().selectEvent
- || eventType == eventNames().selectstartEvent))
- return StayInsideShadowDOM;
-
- return RetargetEvent;
-}
-
-void EventRetargeter::ensureEventPath(Node* node, Event* event)
-{
- calculateEventPath(node, event);
- calculateAdjustedEventPathForEachNode(event->eventPath());
-}
-
-void EventRetargeter::calculateEventPath(Node* node, Event* event)
-{
- EventPath& eventPath = event->eventPath();
- eventPath.clear();
- bool inDocument = node->inDocument();
- bool isSVGElement = node->isSVGElement();
- bool isMouseOrFocusEvent = event->isMouseEvent() || event->isFocusEvent();
- bool isTouchEvent = event->isTouchEvent();
- Vector<EventTarget*, 32> targetStack;
- for (EventPathWalker walker(node); walker.node(); walker.moveToParent()) {
- Node* node = walker.node();
- if (targetStack.isEmpty())
- targetStack.append(eventTargetRespectingTargetRules(node));
- else if (walker.isVisitingInsertionPointInReprojection())
- targetStack.append(targetStack.last());
- if (isMouseOrFocusEvent)
- eventPath.append(adoptPtr(new MouseOrFocusEventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
- else if (isTouchEvent)
- eventPath.append(adoptPtr(new TouchEventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
- else
- eventPath.append(adoptPtr(new EventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
- if (!inDocument)
- break;
- if (!node->isShadowRoot())
- continue;
- if (determineDispatchBehavior(event, toShadowRoot(node), targetStack.last()) == StayInsideShadowDOM)
- break;
- if (!isSVGElement) {
- ASSERT(!targetStack.isEmpty());
- targetStack.removeLast();
- }
- }
-}
-
-void EventRetargeter::calculateAdjustedEventPathForEachNode(EventPath& eventPath)
-{
- if (!RuntimeEnabledFeatures::shadowDOMEnabled())
- return;
- TreeScope* lastScope = 0;
- size_t eventPathSize = eventPath.size();
- for (size_t i = 0; i < eventPathSize; ++i) {
- TreeScope* currentScope = &eventPath[i]->node()->treeScope();
- if (currentScope == lastScope) {
- // Fast path.
- eventPath[i]->setEventPath(eventPath[i - 1]->eventPath());
- continue;
- }
- lastScope = currentScope;
- Vector<RefPtr<Node> > nodes;
- for (size_t j = 0; j < eventPathSize; ++j) {
- Node* node = eventPath[j]->node();
- if (node->treeScope().isInclusiveAncestorOf(*currentScope))
- nodes.append(node);
- }
- eventPath[i]->adoptEventPath(nodes);
- }
-}
-
-void EventRetargeter::adjustForMouseEvent(Node* node, MouseEvent& mouseEvent)
-{
- adjustForRelatedTarget(node, mouseEvent.relatedTarget(), mouseEvent.eventPath());
-}
-
-void EventRetargeter::adjustForFocusEvent(Node* node, FocusEvent& focusEvent)
-{
- adjustForRelatedTarget(node, focusEvent.relatedTarget(), focusEvent.eventPath());
-}
-
-void EventRetargeter::adjustForTouchEvent(Node* node, TouchEvent& touchEvent)
-{
- EventPath& eventPath = touchEvent.eventPath();
- size_t eventPathSize = eventPath.size();
-
- EventPathTouchLists eventPathTouches(eventPathSize);
- EventPathTouchLists eventPathTargetTouches(eventPathSize);
- EventPathTouchLists eventPathChangedTouches(eventPathSize);
-
- for (size_t i = 0; i < eventPathSize; ++i) {
- ASSERT(eventPath[i]->isTouchEventContext());
- TouchEventContext* touchEventContext = toTouchEventContext(eventPath[i].get());
- eventPathTouches[i] = touchEventContext->touches();
- eventPathTargetTouches[i] = touchEventContext->targetTouches();
- eventPathChangedTouches[i] = touchEventContext->changedTouches();
- }
-
- adjustTouchList(node, touchEvent.touches(), eventPath, eventPathTouches);
- adjustTouchList(node, touchEvent.targetTouches(), eventPath, eventPathTargetTouches);
- adjustTouchList(node, touchEvent.changedTouches(), eventPath, eventPathChangedTouches);
-}
-
-void EventRetargeter::adjustTouchList(const Node* node, const TouchList* touchList, const EventPath& eventPath, EventPathTouchLists& eventPathTouchLists)
-{
- if (!touchList)
- return;
- size_t eventPathSize = eventPath.size();
- ASSERT(eventPathTouchLists.size() == eventPathSize);
- for (size_t i = 0; i < touchList->length(); ++i) {
- const Touch& touch = *touchList->item(i);
- AdjustedNodes adjustedNodes;
- calculateAdjustedNodes(node, touch.target()->toNode(), DoesNotStopAtBoundary, const_cast<EventPath&>(eventPath), adjustedNodes);
- ASSERT(adjustedNodes.size() == eventPathSize);
- for (size_t j = 0; j < eventPathSize; ++j)
- eventPathTouchLists[j]->append(touch.cloneWithNewTarget(adjustedNodes[j].get()));
- }
-}
-
-void EventRetargeter::adjustForRelatedTarget(const Node* node, EventTarget* relatedTarget, EventPath& eventPath)
-{
- if (!node)
- return;
- if (!relatedTarget)
- return;
- Node* relatedNode = relatedTarget->toNode();
- if (!relatedNode)
- return;
- AdjustedNodes adjustedNodes;
- calculateAdjustedNodes(node, relatedNode, StopAtBoundaryIfNeeded, eventPath, adjustedNodes);
- ASSERT(adjustedNodes.size() <= eventPath.size());
- for (size_t i = 0; i < adjustedNodes.size(); ++i) {
- ASSERT(eventPath[i]->isMouseOrFocusEventContext());
- MouseOrFocusEventContext* mouseOrFocusEventContext = static_cast<MouseOrFocusEventContext*>(eventPath[i].get());
- mouseOrFocusEventContext->setRelatedTarget(adjustedNodes[i]);
- }
-}
-
-void EventRetargeter::calculateAdjustedNodes(const Node* node, const Node* relatedNode, EventWithRelatedTargetDispatchBehavior eventWithRelatedTargetDispatchBehavior, EventPath& eventPath, AdjustedNodes& adjustedNodes)
-{
- RelatedNodeMap relatedNodeMap;
- buildRelatedNodeMap(relatedNode, relatedNodeMap);
-
- // Synthetic mouse events can have a relatedTarget which is identical to the target.
- bool targetIsIdenticalToToRelatedTarget = (node == relatedNode);
-
- TreeScope* lastTreeScope = 0;
- Node* adjustedNode = 0;
- for (EventPath::const_iterator iter = eventPath.begin(); iter < eventPath.end(); ++iter) {
- TreeScope* scope = &(*iter)->node()->treeScope();
- if (scope == lastTreeScope) {
- // Re-use the previous adjustedRelatedTarget if treeScope does not change. Just for the performance optimization.
- adjustedNodes.append(adjustedNode);
- } else {
- adjustedNode = findRelatedNode(scope, relatedNodeMap);
- adjustedNodes.append(adjustedNode);
- }
- lastTreeScope = scope;
- if (eventWithRelatedTargetDispatchBehavior == DoesNotStopAtBoundary)
- continue;
- if (targetIsIdenticalToToRelatedTarget) {
- if (node->treeScope().rootNode() == (*iter)->node()) {
- eventPath.shrink(iter + 1 - eventPath.begin());
- break;
- }
- } else if ((*iter)->target() == adjustedNode) {
- // Event dispatching should be stopped here.
- eventPath.shrink(iter - eventPath.begin());
- adjustedNodes.shrink(adjustedNodes.size() - 1);
- break;
- }
- }
-}
-
-void EventRetargeter::buildRelatedNodeMap(const Node* relatedNode, RelatedNodeMap& relatedNodeMap)
-{
- Vector<Node*, 32> relatedNodeStack;
- TreeScope* lastTreeScope = 0;
- for (EventPathWalker walker(relatedNode); walker.node(); walker.moveToParent()) {
- Node* node = walker.node();
- if (relatedNodeStack.isEmpty())
- relatedNodeStack.append(node);
- else if (walker.isVisitingInsertionPointInReprojection())
- relatedNodeStack.append(relatedNodeStack.last());
- TreeScope* scope = &node->treeScope();
- // Skips adding a node to the map if treeScope does not change. Just for the performance optimization.
- if (scope != lastTreeScope)
- relatedNodeMap.add(scope, relatedNodeStack.last());
- lastTreeScope = scope;
- if (node->isShadowRoot()) {
- ASSERT(!relatedNodeStack.isEmpty());
- relatedNodeStack.removeLast();
- }
- }
-}
-
-Node* EventRetargeter::findRelatedNode(TreeScope* scope, RelatedNodeMap& relatedNodeMap)
-{
- Vector<TreeScope*, 32> parentTreeScopes;
- Node* relatedNode = 0;
- while (scope) {
- parentTreeScopes.append(scope);
- RelatedNodeMap::const_iterator found = relatedNodeMap.find(scope);
- if (found != relatedNodeMap.end()) {
- relatedNode = found->value;
- break;
- }
- scope = scope->parentTreeScope();
- }
- for (Vector<TreeScope*, 32>::iterator iter = parentTreeScopes.begin(); iter < parentTreeScopes.end(); ++iter)
- relatedNodeMap.add(*iter, relatedNode);
- return relatedNode;
-}
-
-}
diff --git a/Source/core/dom/EventRetargeter.h b/Source/core/dom/EventRetargeter.h
deleted file mode 100644
index ea5b36e..0000000
--- a/Source/core/dom/EventRetargeter.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2013 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef EventRetargeter_h
-#define EventRetargeter_h
-
-#include "SVGNames.h"
-#include "core/dom/ContainerNode.h"
-#include "core/dom/EventContext.h"
-#include "core/dom/shadow/ShadowRoot.h"
-#include "core/svg/SVGElementInstance.h"
-#include "core/svg/SVGUseElement.h"
-#include "wtf/HashMap.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class EventTarget;
-class FocusEvent;
-class MouseEvent;
-class Node;
-class TouchEvent;
-class TreeScope;
-
-enum EventDispatchBehavior {
- RetargetEvent,
- StayInsideShadowDOM
-};
-
-class EventRetargeter {
-public:
- static void ensureEventPath(Node*, Event*);
- static void adjustForMouseEvent(Node*, MouseEvent&);
- static void adjustForFocusEvent(Node*, FocusEvent&);
- typedef Vector<RefPtr<TouchList> > EventPathTouchLists;
- static void adjustForTouchEvent(Node*, TouchEvent&);
- static EventTarget* eventTargetRespectingTargetRules(Node* referenceNode);
-
-private:
- typedef Vector<RefPtr<Node> > AdjustedNodes;
- typedef HashMap<TreeScope*, Node*> RelatedNodeMap;
- enum EventWithRelatedTargetDispatchBehavior {
- StopAtBoundaryIfNeeded,
- DoesNotStopAtBoundary
- };
- static void calculateEventPath(Node*, Event*);
- static void calculateAdjustedEventPathForEachNode(EventPath&);
-
- static void adjustForRelatedTarget(const Node*, EventTarget* relatedTarget, EventPath&);
- static void calculateAdjustedNodes(const Node*, const Node* relatedNode, EventWithRelatedTargetDispatchBehavior, EventPath&, AdjustedNodes&);
- static void buildRelatedNodeMap(const Node*, RelatedNodeMap&);
- static Node* findRelatedNode(TreeScope*, RelatedNodeMap&);
- static void adjustTouchList(const Node*, const TouchList*, const EventPath&, EventPathTouchLists&);
-};
-
-inline EventTarget* EventRetargeter::eventTargetRespectingTargetRules(Node* referenceNode)
-{
- ASSERT(referenceNode);
-
- if (referenceNode->isPseudoElement())
- return referenceNode->parentNode();
-
- if (!referenceNode->isSVGElement() || !referenceNode->isInShadowTree())
- return referenceNode;
-
- // Spec: The event handling for the non-exposed tree works as if the referenced element had been textually included
- // as a deeply cloned child of the 'use' element, except that events are dispatched to the SVGElementInstance objects.
- Node* rootNode = referenceNode->treeScope().rootNode();
- Element* shadowHostElement = rootNode->isShadowRoot() ? toShadowRoot(rootNode)->host() : 0;
- // At this time, SVG nodes are not supported in non-<use> shadow trees.
- if (!shadowHostElement || !shadowHostElement->hasTagName(SVGNames::useTag))
- return referenceNode;
- SVGUseElement* useElement = toSVGUseElement(shadowHostElement);
- if (SVGElementInstance* instance = useElement->instanceForShadowTreeElement(referenceNode))
- return instance;
-
- return referenceNode;
-}
-
-}
-
-#endif // EventRetargeter_h
diff --git a/Source/core/dom/EventSender.h b/Source/core/dom/EventSender.h
deleted file mode 100644
index d738901..0000000
--- a/Source/core/dom/EventSender.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2012 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 INC. AND ITS 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 APPLE INC. OR ITS 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 EventSender_h
-#define EventSender_h
-
-#include "core/platform/Timer.h"
-#include "wtf/Vector.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-template<typename T> class EventSender {
- WTF_MAKE_NONCOPYABLE(EventSender); WTF_MAKE_FAST_ALLOCATED;
-public:
- explicit EventSender(const AtomicString& eventType);
-
- const AtomicString& eventType() const { return m_eventType; }
- void dispatchEventSoon(T*);
- void cancelEvent(T*);
- void dispatchPendingEvents();
-
-#ifndef NDEBUG
- bool hasPendingEvents(T* sender) const
- {
- return m_dispatchSoonList.find(sender) != notFound || m_dispatchingList.find(sender) != notFound;
- }
-#endif
-
-private:
- void timerFired(Timer<EventSender<T> >*) { dispatchPendingEvents(); }
-
- AtomicString m_eventType;
- Timer<EventSender<T> > m_timer;
- Vector<T*> m_dispatchSoonList;
- Vector<T*> m_dispatchingList;
-};
-
-template<typename T> EventSender<T>::EventSender(const AtomicString& eventType)
- : m_eventType(eventType)
- , m_timer(this, &EventSender::timerFired)
-{
-}
-
-template<typename T> void EventSender<T>::dispatchEventSoon(T* sender)
-{
- m_dispatchSoonList.append(sender);
- if (!m_timer.isActive())
- m_timer.startOneShot(0);
-}
-
-template<typename T> void EventSender<T>::cancelEvent(T* sender)
-{
- // Remove instances of this sender from both lists.
- // Use loops because we allow multiple instances to get into the lists.
- size_t size = m_dispatchSoonList.size();
- for (size_t i = 0; i < size; ++i) {
- if (m_dispatchSoonList[i] == sender)
- m_dispatchSoonList[i] = 0;
- }
- size = m_dispatchingList.size();
- for (size_t i = 0; i < size; ++i) {
- if (m_dispatchingList[i] == sender)
- m_dispatchingList[i] = 0;
- }
-}
-
-template<typename T> void EventSender<T>::dispatchPendingEvents()
-{
- // Need to avoid re-entering this function; if new dispatches are
- // scheduled before the parent finishes processing the list, they
- // will set a timer and eventually be processed.
- if (!m_dispatchingList.isEmpty())
- return;
-
- m_timer.stop();
-
- m_dispatchingList.swap(m_dispatchSoonList);
- size_t size = m_dispatchingList.size();
- for (size_t i = 0; i < size; ++i) {
- if (T* sender = m_dispatchingList[i]) {
- m_dispatchingList[i] = 0;
- sender->dispatchPendingEvent(this);
- }
- }
- m_dispatchingList.clear();
-}
-
-} // namespace WebCore
-
-#endif // EventSender_h
diff --git a/Source/core/dom/EventTarget.cpp b/Source/core/dom/EventTarget.cpp
deleted file mode 100644
index 5745d7f..0000000
--- a/Source/core/dom/EventTarget.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * 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 "core/dom/EventTarget.h"
-
-#include "RuntimeEnabledFeatures.h"
-#include "bindings/v8/DOMWrapperWorld.h"
-#include "bindings/v8/ExceptionState.h"
-#include "bindings/v8/ScriptController.h"
-#include "core/dom/Event.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/page/DOMWindow.h"
-#include "wtf/StdLibExtras.h"
-#include "wtf/Vector.h"
-
-using namespace WTF;
-
-namespace WebCore {
-
-EventTargetData::EventTargetData()
-{
-}
-
-EventTargetData::~EventTargetData()
-{
-}
-
-EventTarget::~EventTarget()
-{
-}
-
-Node* EventTarget::toNode()
-{
- return 0;
-}
-
-DOMWindow* EventTarget::toDOMWindow()
-{
- return 0;
-}
-
-MessagePort* EventTarget::toMessagePort()
-{
- return 0;
-}
-
-inline DOMWindow* EventTarget::executingWindow()
-{
- if (ScriptExecutionContext* context = scriptExecutionContext())
- return context->executingWindow();
- return 0;
-}
-
-bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
-{
- EventTargetData* d = ensureEventTargetData();
- return d->eventListenerMap.add(eventType, listener, useCapture);
-}
-
-bool EventTarget::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture)
-{
- EventTargetData* d = eventTargetData();
- if (!d)
- return false;
-
- size_t indexOfRemovedListener;
-
- if (!d->eventListenerMap.remove(eventType, listener, useCapture, indexOfRemovedListener))
- return false;
-
- // Notify firing events planning to invoke the listener at 'index' that
- // they have one less listener to invoke.
- if (!d->firingEventIterators)
- return true;
- for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
- FiringEventIterator& firingIterator = d->firingEventIterators->at(i);
- if (eventType != firingIterator.eventType)
- continue;
-
- if (indexOfRemovedListener >= firingIterator.end)
- continue;
-
- --firingIterator.end;
- if (indexOfRemovedListener <= firingIterator.iterator)
- --firingIterator.iterator;
- }
-
- return true;
-}
-
-bool EventTarget::setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld)
-{
- clearAttributeEventListener(eventType, isolatedWorld);
- if (!listener)
- return false;
- return addEventListener(eventType, listener, false);
-}
-
-EventListener* EventTarget::getAttributeEventListener(const AtomicString& eventType, DOMWrapperWorld* isolatedWorld)
-{
- const EventListenerVector& entry = getEventListeners(eventType);
- for (size_t i = 0; i < entry.size(); ++i) {
- EventListener* listener = entry[i].listener.get();
- if (listener->isAttribute()) {
- DOMWrapperWorld* listenerWorld = listener->world();
- // Worker listener
- if (!listenerWorld) {
- ASSERT(!isolatedWorld);
- return listener;
- }
- if (listenerWorld->isMainWorld() && !isolatedWorld)
- return listener;
- if (listenerWorld == isolatedWorld)
- return listener;
- }
- }
- return 0;
-}
-
-bool EventTarget::clearAttributeEventListener(const AtomicString& eventType, DOMWrapperWorld* isolatedWorld)
-{
- EventListener* listener = getAttributeEventListener(eventType, isolatedWorld);
- if (!listener)
- return false;
- return removeEventListener(eventType, listener, false);
-}
-
-bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionState& es)
-{
- if (!event || event->type().isEmpty() || event->isBeingDispatched()) {
- es.throwDOMException(InvalidStateError);
- return false;
- }
-
- if (!scriptExecutionContext())
- return false;
-
- return dispatchEvent(event);
-}
-
-bool EventTarget::dispatchEvent(PassRefPtr<Event> event)
-{
- event->setTarget(this);
- event->setCurrentTarget(this);
- event->setEventPhase(Event::AT_TARGET);
- bool defaultPrevented = fireEventListeners(event.get());
- event->setEventPhase(0);
- return defaultPrevented;
-}
-
-void EventTarget::uncaughtExceptionInEventHandler()
-{
-}
-
-static AtomicString legacyType(const Event* event)
-{
- if (event->type() == eventNames().transitionendEvent)
- return eventNames().webkitTransitionEndEvent;
-
- if (event->type() == eventNames().animationstartEvent)
- return eventNames().webkitAnimationStartEvent;
-
- if (event->type() == eventNames().animationendEvent)
- return eventNames().webkitAnimationEndEvent;
-
- if (event->type() == eventNames().animationiterationEvent)
- return eventNames().webkitAnimationIterationEvent;
-
- if (event->type() == eventNames().wheelEvent)
- return eventNames().mousewheelEvent;
-
- return emptyString();
-}
-
-void EventTarget::countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVector* listenersVector, EventListenerVector* legacyListenersVector)
-{
- UseCounter::Feature unprefixedFeature;
- UseCounter::Feature prefixedFeature;
- UseCounter::Feature prefixedAndUnprefixedFeature;
- bool shouldCount = false;
-
- if (legacyTypeName == eventNames().webkitTransitionEndEvent) {
- prefixedFeature = UseCounter::PrefixedTransitionEndEvent;
- unprefixedFeature = UseCounter::UnprefixedTransitionEndEvent;
- prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedTransitionEndEvent;
- shouldCount = true;
- } else if (legacyTypeName == eventNames().webkitAnimationEndEvent) {
- prefixedFeature = UseCounter::PrefixedAnimationEndEvent;
- unprefixedFeature = UseCounter::UnprefixedAnimationEndEvent;
- prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimationEndEvent;
- shouldCount = true;
- } else if (legacyTypeName == eventNames().webkitAnimationStartEvent) {
- prefixedFeature = UseCounter::PrefixedAnimationStartEvent;
- unprefixedFeature = UseCounter::UnprefixedAnimationStartEvent;
- prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimationStartEvent;
- shouldCount = true;
- } else if (legacyTypeName == eventNames().webkitAnimationIterationEvent) {
- prefixedFeature = UseCounter::PrefixedAnimationIterationEvent;
- unprefixedFeature = UseCounter::UnprefixedAnimationIterationEvent;
- prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimationIterationEvent;
- shouldCount = true;
- }
-
- if (shouldCount) {
- if (DOMWindow* executingWindow = this->executingWindow()) {
- if (legacyListenersVector) {
- if (listenersVector)
- UseCounter::count(executingWindow, prefixedAndUnprefixedFeature);
- else
- UseCounter::count(executingWindow, prefixedFeature);
- } else if (listenersVector) {
- UseCounter::count(executingWindow, unprefixedFeature);
- }
- }
- }
-}
-
-bool EventTarget::fireEventListeners(Event* event)
-{
- ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
- ASSERT(event && !event->type().isEmpty());
-
- EventTargetData* d = eventTargetData();
- if (!d)
- return true;
-
- EventListenerVector* legacyListenersVector = 0;
- AtomicString legacyTypeName = legacyType(event);
- if (!legacyTypeName.isEmpty())
- legacyListenersVector = d->eventListenerMap.find(legacyTypeName);
-
- EventListenerVector* listenersVector = d->eventListenerMap.find(event->type());
- if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && (event->type() == eventNames().animationiterationEvent || event->type() == eventNames().animationendEvent
- || event->type() == eventNames().animationstartEvent))
- listenersVector = 0;
-
- if (listenersVector) {
- fireEventListeners(event, d, *listenersVector);
- } else if (legacyListenersVector) {
- AtomicString unprefixedTypeName = event->type();
- event->setType(legacyTypeName);
- fireEventListeners(event, d, *legacyListenersVector);
- event->setType(unprefixedTypeName);
- }
-
- countLegacyEvents(legacyTypeName, listenersVector, legacyListenersVector);
- return !event->defaultPrevented();
-}
-
-void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventListenerVector& entry)
-{
- RefPtr<EventTarget> protect = this;
-
- // Fire all listeners registered for this event. Don't fire listeners removed
- // during event dispatch. Also, don't fire event listeners added during event
- // dispatch. Conveniently, all new event listeners will be added after or at
- // index |size|, so iterating up to (but not including) |size| naturally excludes
- // new event listeners.
-
- if (event->type() == eventNames().beforeunloadEvent) {
- if (DOMWindow* executingWindow = this->executingWindow()) {
- if (executingWindow->top())
- UseCounter::count(executingWindow, UseCounter::SubFrameBeforeUnloadFired);
- }
- }
-
- bool userEventWasHandled = false;
- size_t i = 0;
- size_t size = entry.size();
- if (!d->firingEventIterators)
- d->firingEventIterators = adoptPtr(new FiringEventIteratorVector);
- d->firingEventIterators->append(FiringEventIterator(event->type(), i, size));
- for ( ; i < size; ++i) {
- RegisteredEventListener& registeredListener = entry[i];
- if (event->eventPhase() == Event::CAPTURING_PHASE && !registeredListener.useCapture)
- continue;
- if (event->eventPhase() == Event::BUBBLING_PHASE && registeredListener.useCapture)
- continue;
-
- // If stopImmediatePropagation has been called, we just break out immediately, without
- // handling any more events on this target.
- if (event->immediatePropagationStopped())
- break;
-
- ScriptExecutionContext* context = scriptExecutionContext();
- if (!context)
- break;
-
- InspectorInstrumentationCookie cookie = InspectorInstrumentation::willHandleEvent(context, event);
- // To match Mozilla, the AT_TARGET phase fires both capturing and bubbling
- // event listeners, even though that violates some versions of the DOM spec.
- registeredListener.listener->handleEvent(context, event);
- if (!userEventWasHandled && ScriptController::processingUserGesture())
- userEventWasHandled = true;
- InspectorInstrumentation::didHandleEvent(cookie);
- }
- d->firingEventIterators->removeLast();
- if (userEventWasHandled) {
- if (ScriptExecutionContext* context = scriptExecutionContext())
- context->userEventWasHandled();
- }
-}
-
-const EventListenerVector& EventTarget::getEventListeners(const AtomicString& eventType)
-{
- DEFINE_STATIC_LOCAL(EventListenerVector, emptyVector, ());
-
- EventTargetData* d = eventTargetData();
- if (!d)
- return emptyVector;
-
- EventListenerVector* listenerVector = d->eventListenerMap.find(eventType);
- if (!listenerVector)
- return emptyVector;
-
- return *listenerVector;
-}
-
-void EventTarget::removeAllEventListeners()
-{
- EventTargetData* d = eventTargetData();
- if (!d)
- return;
- d->eventListenerMap.clear();
-
- // Notify firing events planning to invoke the listener at 'index' that
- // they have one less listener to invoke.
- if (d->firingEventIterators) {
- for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
- d->firingEventIterators->at(i).iterator = 0;
- d->firingEventIterators->at(i).end = 0;
- }
- }
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/EventTarget.h b/Source/core/dom/EventTarget.h
deleted file mode 100644
index 3a5dc0a..0000000
--- a/Source/core/dom/EventTarget.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * 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 EventTarget_h
-#define EventTarget_h
-
-#include "core/dom/EventListenerMap.h"
-#include "core/dom/EventNames.h"
-#include "wtf/Forward.h"
-
-namespace WebCore {
-
- class ApplicationCache;
- class AudioContext;
- class DOMWindow;
- class DedicatedWorkerGlobalScope;
- class Event;
- class EventListener;
- class EventSource;
- class ExceptionState;
- class FileReader;
- class FileWriter;
- class IDBDatabase;
- class IDBRequest;
- class IDBTransaction;
- class MIDIAccess;
- class MIDIInput;
- class MIDIPort;
- class MediaController;
- class MediaStream;
- class MessagePort;
- class NamedFlow;
- class Node;
- class Notification;
- class SVGElementInstance;
- class ScriptExecutionContext;
- class ScriptProcessorNode;
- class SharedWorker;
- class SharedWorkerGlobalScope;
- class TextTrack;
- class TextTrackCue;
- class WebSocket;
- class Worker;
- class XMLHttpRequest;
- class XMLHttpRequestUpload;
-
- struct FiringEventIterator {
- FiringEventIterator(const AtomicString& eventType, size_t& iterator, size_t& end)
- : eventType(eventType)
- , iterator(iterator)
- , end(end)
- {
- }
-
- const AtomicString& eventType;
- size_t& iterator;
- size_t& end;
- };
- typedef Vector<FiringEventIterator, 1> FiringEventIteratorVector;
-
- struct EventTargetData {
- WTF_MAKE_NONCOPYABLE(EventTargetData); WTF_MAKE_FAST_ALLOCATED;
- public:
- EventTargetData();
- ~EventTargetData();
-
- EventListenerMap eventListenerMap;
- OwnPtr<FiringEventIteratorVector> firingEventIterators;
- };
-
- class EventTarget {
- public:
- void ref() { refEventTarget(); }
- void deref() { derefEventTarget(); }
-
- virtual const AtomicString& interfaceName() const = 0;
- virtual ScriptExecutionContext* scriptExecutionContext() const = 0;
-
- virtual Node* toNode();
- virtual DOMWindow* toDOMWindow();
- virtual MessagePort* toMessagePort();
-
- virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
- virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
- virtual void removeAllEventListeners();
- virtual bool dispatchEvent(PassRefPtr<Event>);
- bool dispatchEvent(PassRefPtr<Event>, ExceptionState&); // DOM API
- virtual void uncaughtExceptionInEventHandler();
-
- // Used for legacy "onEvent" attribute APIs.
- bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, DOMWrapperWorld* isolatedWorld = 0);
- EventListener* getAttributeEventListener(const AtomicString& eventType, DOMWrapperWorld* isolatedWorld = 0);
-
- bool hasEventListeners();
- bool hasEventListeners(const AtomicString& eventType);
- bool hasCapturingEventListeners(const AtomicString& eventType);
- const EventListenerVector& getEventListeners(const AtomicString& eventType);
-
- bool fireEventListeners(Event*);
- bool isFiringEventListeners();
-
- protected:
- virtual ~EventTarget();
-
- virtual EventTargetData* eventTargetData() = 0;
- virtual EventTargetData* ensureEventTargetData() = 0;
-
- private:
- virtual void refEventTarget() = 0;
- virtual void derefEventTarget() = 0;
-
- DOMWindow* executingWindow();
- void fireEventListeners(Event*, EventTargetData*, EventListenerVector&);
- void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVector*, EventListenerVector*);
-
- bool clearAttributeEventListener(const AtomicString& eventType, DOMWrapperWorld* isolatedWorld);
-
- friend class EventListenerIterator;
- };
-
- // FIXME: These macros should be split into separate DEFINE and DECLARE
- // macros to avoid causing so many header includes.
- #define DEFINE_ATTRIBUTE_EVENT_LISTENER(attribute) \
- EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(eventNames().attribute##Event, isolatedWorld); } \
- void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld = 0) { setAttributeEventListener(eventNames().attribute##Event, listener, isolatedWorld); } \
-
- #define DECLARE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(attribute) \
- virtual EventListener* on##attribute(DOMWrapperWorld* isolatedWorld); \
- virtual void setOn##attribute(PassRefPtr<EventListener>, DOMWrapperWorld* isolatedWorld); \
-
- #define DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(type, attribute) \
- EventListener* type::on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(eventNames().attribute##Event, isolatedWorld); } \
- void type::setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { setAttributeEventListener(eventNames().attribute##Event, listener, isolatedWorld); } \
-
- #define DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(attribute) \
- EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return document().getWindowAttributeEventListener(eventNames().attribute##Event, isolatedWorld); } \
- void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { document().setWindowAttributeEventListener(eventNames().attribute##Event, listener, isolatedWorld); } \
-
- #define DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(attribute, eventName) \
- EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(eventNames().eventName##Event, isolatedWorld); } \
- void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { setAttributeEventListener(eventNames().eventName##Event, listener, isolatedWorld); } \
-
- #define DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(recipient, attribute) \
- EventListener* on##attribute(DOMWrapperWorld* isolatedWorld); \
- void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld);
-
- #define DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(type, recipient, attribute) \
- EventListener* type::on##attribute(DOMWrapperWorld* isolatedWorld) { return recipient ? recipient->getAttributeEventListener(eventNames().attribute##Event, isolatedWorld) : 0; } \
- void type::setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { if (recipient) recipient->setAttributeEventListener(eventNames().attribute##Event, listener, isolatedWorld); }
-
- inline bool EventTarget::isFiringEventListeners()
- {
- EventTargetData* d = eventTargetData();
- if (!d)
- return false;
- return d->firingEventIterators && !d->firingEventIterators->isEmpty();
- }
-
- inline bool EventTarget::hasEventListeners()
- {
- EventTargetData* d = eventTargetData();
- if (!d)
- return false;
- return !d->eventListenerMap.isEmpty();
- }
-
- inline bool EventTarget::hasEventListeners(const AtomicString& eventType)
- {
- EventTargetData* d = eventTargetData();
- if (!d)
- return false;
- return d->eventListenerMap.contains(eventType);
- }
-
- inline bool EventTarget::hasCapturingEventListeners(const AtomicString& eventType)
- {
- EventTargetData* d = eventTargetData();
- if (!d)
- return false;
- return d->eventListenerMap.containsCapturing(eventType);
- }
-
-} // namespace WebCore
-
-#endif // EventTarget_h
diff --git a/Source/core/dom/EventTarget.idl b/Source/core/dom/EventTarget.idl
deleted file mode 100644
index 7c87036..0000000
--- a/Source/core/dom/EventTarget.idl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-[
- CustomToV8,
- DoNotGenerateWrap
-] interface EventTarget {
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
-};
diff --git a/Source/core/dom/EventTargetFactory.in b/Source/core/dom/EventTargetFactory.in
deleted file mode 100644
index 9ead7d2..0000000
--- a/Source/core/dom/EventTargetFactory.in
+++ /dev/null
@@ -1,47 +0,0 @@
-namespace="EventTarget"
-
-core/css/FontFaceSet
-core/dom/MessagePort
-core/dom/Node
-core/dom/WebKitNamedFlow ImplementedAs=NamedFlow
-core/fileapi/FileReader
-core/html/MediaController
-core/html/track/TextTrack
-core/html/track/TextTrackCue
-core/html/track/TextTrackList
-core/loader/appcache/ApplicationCache
-core/page/EventSource
-core/page/Performance
-core/page/Window ImplementedAs=DOMWindow
-core/svg/SVGElementInstance
-core/workers/DedicatedWorkerGlobalScope
-core/workers/SharedWorker
-core/workers/SharedWorkerGlobalScope
-core/workers/Worker
-core/xml/XMLHttpRequest
-core/xml/XMLHttpRequestUpload
-modules/encryptedmedia/MediaKeySession Conditional=ENCRYPTED_MEDIA_V2
-modules/filesystem/FileWriter
-modules/indexeddb/IDBDatabase
-modules/indexeddb/IDBOpenDBRequest
-modules/indexeddb/IDBRequest
-modules/indexeddb/IDBTransaction
-modules/mediasource/MediaSource
-modules/mediasource/SourceBuffer
-modules/mediasource/SourceBufferList
-modules/mediasource/WebKitMediaSource
-modules/mediasource/WebKitSourceBufferList
-modules/mediastream/MediaStream
-modules/mediastream/MediaStreamTrack
-modules/mediastream/RTCDTMFSender
-modules/mediastream/RTCDataChannel
-modules/mediastream/RTCPeerConnection
-modules/notifications/Notification
-modules/speech/SpeechRecognition
-modules/speech/SpeechSynthesisUtterance
-modules/webaudio/AudioContext Conditional=WEB_AUDIO
-modules/webaudio/AudioNode Conditional=WEB_AUDIO
-modules/webmidi/MIDIAccess
-modules/webmidi/MIDIInput
-modules/webmidi/MIDIPort
-modules/websockets/WebSocket
diff --git a/Source/core/dom/FocusEvent.cpp b/Source/core/dom/FocusEvent.cpp
deleted file mode 100644
index 6d9569d..0000000
--- a/Source/core/dom/FocusEvent.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "core/dom/FocusEvent.h"
-
-#include "core/dom/Event.h"
-#include "core/dom/EventDispatcher.h"
-#include "core/dom/EventNames.h"
-#include "core/dom/EventRetargeter.h"
-
-namespace WebCore {
-
-FocusEventInit::FocusEventInit()
- : relatedTarget(0)
-{
-}
-
-const AtomicString& FocusEvent::interfaceName() const
-{
- return eventNames().interfaceForFocusEvent;
-}
-
-bool FocusEvent::isFocusEvent() const
-{
- return true;
-}
-
-FocusEvent::FocusEvent()
-{
- ScriptWrappable::init(this);
-}
-
-FocusEvent::FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, int detail, EventTarget* relatedTarget)
- : UIEvent(type, canBubble, cancelable, view, detail)
- , m_relatedTarget(relatedTarget)
-{
- ScriptWrappable::init(this);
-}
-
-FocusEvent::FocusEvent(const AtomicString& type, const FocusEventInit& initializer)
- : UIEvent(type, initializer)
- , m_relatedTarget(initializer.relatedTarget)
-{
- ScriptWrappable::init(this);
-}
-
-PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent)
-{
- return adoptRef(new FocusEventDispatchMediator(focusEvent));
-}
-
-FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent)
- : EventDispatchMediator(focusEvent)
-{
-}
-
-bool FocusEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event());
- return EventDispatchMediator::dispatchEvent(dispatcher);
-}
-
-PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent)
-{
- return adoptRef(new BlurEventDispatchMediator(focusEvent));
-}
-
-BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent)
- : EventDispatchMediator(focusEvent)
-{
-}
-
-bool BlurEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event());
- return EventDispatchMediator::dispatchEvent(dispatcher);
-}
-
-PassRefPtr<FocusInEventDispatchMediator> FocusInEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent)
-{
- return adoptRef(new FocusInEventDispatchMediator(focusEvent));
-}
-
-FocusInEventDispatchMediator::FocusInEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent)
- : EventDispatchMediator(focusEvent)
-{
-}
-
-bool FocusInEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event());
- return EventDispatchMediator::dispatchEvent(dispatcher);
-}
-
-PassRefPtr<FocusOutEventDispatchMediator> FocusOutEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent)
-{
- return adoptRef(new FocusOutEventDispatchMediator(focusEvent));
-}
-
-FocusOutEventDispatchMediator::FocusOutEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent)
- : EventDispatchMediator(focusEvent)
-{
-}
-
-bool FocusOutEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event());
- return EventDispatchMediator::dispatchEvent(dispatcher);
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/FocusEvent.h b/Source/core/dom/FocusEvent.h
deleted file mode 100644
index f96c076..0000000
--- a/Source/core/dom/FocusEvent.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 FocusEvent_h
-#define FocusEvent_h
-
-#include "core/dom/EventTarget.h"
-#include "core/dom/UIEvent.h"
-
-namespace WebCore {
-
-class Node;
-
-struct FocusEventInit : public UIEventInit {
- FocusEventInit();
-
- RefPtr<EventTarget> relatedTarget;
-};
-
-class FocusEvent : public UIEvent {
-public:
- static PassRefPtr<FocusEvent> create()
- {
- return adoptRef(new FocusEvent);
- }
-
- static PassRefPtr<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, int detail, EventTarget* relatedTarget)
- {
- return adoptRef(new FocusEvent(type, canBubble, cancelable, view, detail, relatedTarget));
- }
-
- static PassRefPtr<FocusEvent> create(const AtomicString& type, const FocusEventInit& initializer)
- {
- return adoptRef(new FocusEvent(type, initializer));
- }
-
- EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
- void setRelatedTarget(EventTarget* relatedTarget) { m_relatedTarget = relatedTarget; }
-
- virtual const AtomicString& interfaceName() const;
- virtual bool isFocusEvent() const;
-
-private:
- FocusEvent();
- FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int, EventTarget*);
- FocusEvent(const AtomicString& type, const FocusEventInit&);
-
- RefPtr<EventTarget> m_relatedTarget;
-};
-
-inline FocusEvent* toFocusEvent(Event* event)
-{
- ASSERT(event && event->isFocusEvent());
- return static_cast<FocusEvent*>(event);
-}
-
-class FocusEventDispatchMediator : public EventDispatchMediator {
-public:
- static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<FocusEvent>);
-private:
- explicit FocusEventDispatchMediator(PassRefPtr<FocusEvent>);
- FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); }
- virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
-};
-
-class BlurEventDispatchMediator : public EventDispatchMediator {
-public:
- static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<FocusEvent>);
-private:
- explicit BlurEventDispatchMediator(PassRefPtr<FocusEvent>);
- FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); }
- virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
-};
-
-class FocusInEventDispatchMediator : public EventDispatchMediator {
-public:
- static PassRefPtr<FocusInEventDispatchMediator> create(PassRefPtr<FocusEvent>);
-private:
- explicit FocusInEventDispatchMediator(PassRefPtr<FocusEvent>);
- FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); }
- virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
-};
-
-class FocusOutEventDispatchMediator : public EventDispatchMediator {
-public:
- static PassRefPtr<FocusOutEventDispatchMediator> create(PassRefPtr<FocusEvent>);
-private:
- explicit FocusOutEventDispatchMediator(PassRefPtr<FocusEvent>);
- FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); }
- virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
-};
-
-} // namespace WebCore
-
-#endif // FocusEvent_h
diff --git a/Source/core/dom/FocusEvent.idl b/Source/core/dom/FocusEvent.idl
deleted file mode 100644
index 659e576..0000000
--- a/Source/core/dom/FocusEvent.idl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
- */
-
-[
- ConstructorTemplate=Event
-] interface FocusEvent : UIEvent {
- [InitializedByEventConstructor] readonly attribute EventTarget relatedTarget;
-};
diff --git a/Source/core/dom/FullscreenElementStack.cpp b/Source/core/dom/FullscreenElementStack.cpp
index ae70534..b8654e8 100644
--- a/Source/core/dom/FullscreenElementStack.cpp
+++ b/Source/core/dom/FullscreenElementStack.cpp
@@ -32,7 +32,7 @@
#include "bindings/v8/ScriptController.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
-#include "core/dom/Event.h"
+#include "core/events/Event.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
@@ -367,11 +367,6 @@
m_fullScreenElement = element;
-#if USE(NATIVE_FULLSCREEN_VIDEO)
- if (element && element->isMediaElement())
- return;
-#endif
-
// Create a placeholder block for a the full-screen element, to keep the page from reflowing
// when the element is removed from the normal flow. Only do this for a RenderBox, as only
// a box will have a frameRect. The placeholder will be created in setFullScreenRenderer()
diff --git a/Source/core/dom/GenericEventQueue.cpp b/Source/core/dom/GenericEventQueue.cpp
deleted file mode 100644
index b002fd6..0000000
--- a/Source/core/dom/GenericEventQueue.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2012 Victor Carbune (victor@rosedu.org)
- *
- * 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 "core/dom/GenericEventQueue.h"
-
-#include "core/dom/Event.h"
-
-namespace WebCore {
-
-PassOwnPtr<GenericEventQueue> GenericEventQueue::create(EventTarget* owner)
-{
- return adoptPtr(new GenericEventQueue(owner));
-}
-
-GenericEventQueue::GenericEventQueue(EventTarget* owner)
- : m_owner(owner)
- , m_timer(this, &GenericEventQueue::timerFired)
- , m_isClosed(false)
-{
-}
-
-GenericEventQueue::~GenericEventQueue()
-{
-}
-
-bool GenericEventQueue::enqueueEvent(PassRefPtr<Event> event)
-{
- if (m_isClosed)
- return false;
-
- if (event->target() == m_owner)
- event->setTarget(0);
-
- m_pendingEvents.append(event);
-
- if (!m_timer.isActive())
- m_timer.startOneShot(0);
-
- return true;
-}
-
-bool GenericEventQueue::cancelEvent(Event* event)
-{
- bool found = m_pendingEvents.contains(event);
-
- if (found)
- m_pendingEvents.remove(m_pendingEvents.find(event));
-
- if (m_pendingEvents.isEmpty())
- m_timer.stop();
-
- return found;
-}
-
-void GenericEventQueue::timerFired(Timer<GenericEventQueue>*)
-{
- ASSERT(!m_timer.isActive());
- ASSERT(!m_pendingEvents.isEmpty());
-
- Vector<RefPtr<Event> > pendingEvents;
- m_pendingEvents.swap(pendingEvents);
-
- RefPtr<EventTarget> protect(m_owner);
- for (unsigned i = 0; i < pendingEvents.size(); ++i) {
- EventTarget* target = pendingEvents[i]->target() ? pendingEvents[i]->target() : m_owner;
- target->dispatchEvent(pendingEvents[i].release());
- }
-}
-
-void GenericEventQueue::close()
-{
- m_isClosed = true;
-
- m_timer.stop();
- m_pendingEvents.clear();
-}
-
-void GenericEventQueue::cancelAllEvents()
-{
- m_timer.stop();
- m_pendingEvents.clear();
-}
-
-bool GenericEventQueue::hasPendingEvents() const
-{
- return m_pendingEvents.size();
-}
-
-}
diff --git a/Source/core/dom/GenericEventQueue.h b/Source/core/dom/GenericEventQueue.h
deleted file mode 100644
index a4d1c20..0000000
--- a/Source/core/dom/GenericEventQueue.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2012 Victor Carbune (victor@rosedu.org)
- *
- * 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 GenericEventQueue_h
-#define GenericEventQueue_h
-
-#include "core/dom/EventQueue.h"
-#include "core/dom/EventTarget.h"
-#include "core/platform/Timer.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class GenericEventQueue : public EventQueue {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- explicit GenericEventQueue(EventTarget*);
- static PassOwnPtr<GenericEventQueue> create(EventTarget*);
- virtual ~GenericEventQueue();
-
- // EventQueue
- virtual bool enqueueEvent(PassRefPtr<Event>) OVERRIDE;
- virtual bool cancelEvent(Event*) OVERRIDE;
- virtual void close() OVERRIDE;
-
- void cancelAllEvents();
- bool hasPendingEvents() const;
-
-private:
- void timerFired(Timer<GenericEventQueue>*);
-
- EventTarget* m_owner;
- Vector<RefPtr<Event> > m_pendingEvents;
- Timer<GenericEventQueue> m_timer;
-
- bool m_isClosed;
-};
-
-}
-
-#endif
diff --git a/Source/core/dom/GestureEvent.cpp b/Source/core/dom/GestureEvent.cpp
deleted file mode 100644
index 6423c0a..0000000
--- a/Source/core/dom/GestureEvent.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "core/dom/Element.h"
-#include "core/dom/GestureEvent.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-PassRefPtr<GestureEvent> GestureEvent::create()
-{
- return adoptRef(new GestureEvent);
-}
-
-PassRefPtr<GestureEvent> GestureEvent::create(PassRefPtr<AbstractView> view, const PlatformGestureEvent& event)
-{
- AtomicString eventType;
- switch (event.type()) {
- case PlatformEvent::GestureScrollBegin:
- eventType = eventNames().gesturescrollstartEvent; break;
- case PlatformEvent::GestureScrollEnd:
- eventType = eventNames().gesturescrollendEvent; break;
- case PlatformEvent::GestureScrollUpdate:
- case PlatformEvent::GestureScrollUpdateWithoutPropagation:
- eventType = eventNames().gesturescrollupdateEvent; break;
- case PlatformEvent::GestureTap:
- eventType = eventNames().gesturetapEvent; break;
- case PlatformEvent::GestureTapUnconfirmed:
- eventType = eventNames().gesturetapunconfirmedEvent; break;
- case PlatformEvent::GestureTapDown:
- eventType = eventNames().gesturetapdownEvent; break;
- case PlatformEvent::GestureTwoFingerTap:
- case PlatformEvent::GestureLongPress:
- case PlatformEvent::GesturePinchBegin:
- case PlatformEvent::GesturePinchEnd:
- case PlatformEvent::GesturePinchUpdate:
- case PlatformEvent::GestureTapDownCancel:
- default:
- return 0;
- }
- return adoptRef(new GestureEvent(eventType, view, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.deltaX(), event.deltaY()));
-}
-
-void GestureEvent::initGestureEvent(const AtomicString& type, PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY)
-{
- if (dispatched())
- return;
-
- initUIEvent(type, true, true, view, 0);
- m_screenLocation = IntPoint(screenX, screenY);
- m_ctrlKey = ctrlKey;
- m_altKey = altKey;
- m_shiftKey = shiftKey;
- m_metaKey = metaKey;
-
- m_deltaX = deltaX;
- m_deltaY = deltaY;
-
- initCoordinates(IntPoint(clientX, clientY));
-}
-
-const AtomicString& GestureEvent::interfaceName() const
-{
- // FIXME: when a GestureEvent.idl interface is defined, return the string "GestureEvent".
- // Until that happens, do not advertise an interface that does not exist, since it will
- // trip up the bindings integrity checks.
- return UIEvent::interfaceName();
-}
-
-GestureEvent::GestureEvent()
- : m_deltaX(0)
- , m_deltaY(0)
-{
-}
-
-GestureEvent::GestureEvent(const AtomicString& type, PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY)
- : MouseRelatedEvent(type, true, true, view, 0, IntPoint(screenX, screenY), IntPoint(clientX, clientY), IntPoint(0, 0), ctrlKey, altKey, shiftKey, metaKey)
- , m_deltaX(deltaX)
- , m_deltaY(deltaY)
-{
-}
-
-GestureEventDispatchMediator::GestureEventDispatchMediator(PassRefPtr<GestureEvent> gestureEvent)
- : EventDispatchMediator(gestureEvent)
-{
-}
-
-GestureEvent* GestureEventDispatchMediator::event() const
-{
- return static_cast<GestureEvent*>(EventDispatchMediator::event());
-}
-
-bool GestureEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
- dispatcher->dispatch();
- ASSERT(!event()->defaultPrevented());
- return event()->defaultHandled() || event()->defaultPrevented();
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/GestureEvent.h b/Source/core/dom/GestureEvent.h
deleted file mode 100644
index a0d6f2e..0000000
--- a/Source/core/dom/GestureEvent.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 GestureEvent_h
-#define GestureEvent_h
-
-#include "core/dom/EventDispatcher.h"
-#include "core/dom/MouseRelatedEvent.h"
-#include "core/platform/PlatformGestureEvent.h"
-
-namespace WebCore {
-
-class GestureEvent : public MouseRelatedEvent {
-public:
- virtual ~GestureEvent() { }
-
- static PassRefPtr<GestureEvent> create();
- static PassRefPtr<GestureEvent> create(PassRefPtr<AbstractView>, const PlatformGestureEvent&);
-
- void initGestureEvent(const AtomicString& type, PassRefPtr<AbstractView>, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY);
-
- virtual const AtomicString& interfaceName() const;
-
- float deltaX() const { return m_deltaX; }
- float deltaY() const { return m_deltaY; }
-
-private:
- GestureEvent();
- GestureEvent(const AtomicString& type, PassRefPtr<AbstractView>, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY);
-
- float m_deltaX;
- float m_deltaY;
-};
-
-class GestureEventDispatchMediator : public EventDispatchMediator {
-public:
- static PassRefPtr<GestureEventDispatchMediator> create(PassRefPtr<GestureEvent> gestureEvent)
- {
- return adoptRef(new GestureEventDispatchMediator(gestureEvent));
- }
-
-private:
- explicit GestureEventDispatchMediator(PassRefPtr<GestureEvent>);
-
- GestureEvent* event() const;
-
- virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
-};
-
-} // namespace WebCore
-
-#endif // GestureEvent_h
diff --git a/Source/core/dom/HashChangeEvent.h b/Source/core/dom/HashChangeEvent.h
deleted file mode 100644
index dee8c10..0000000
--- a/Source/core/dom/HashChangeEvent.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2010 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef HashChangeEvent_h
-#define HashChangeEvent_h
-
-#include "core/dom/Event.h"
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-struct HashChangeEventInit : public EventInit {
- HashChangeEventInit()
- {
- };
-
- String oldURL;
- String newURL;
-};
-
-class HashChangeEvent : public Event {
-public:
- static PassRefPtr<HashChangeEvent> create()
- {
- return adoptRef(new HashChangeEvent);
- }
-
- static PassRefPtr<HashChangeEvent> create(const String& oldURL, const String& newURL)
- {
- return adoptRef(new HashChangeEvent(oldURL, newURL));
- }
-
- static PassRefPtr<HashChangeEvent> create(const AtomicString& type, const HashChangeEventInit& initializer)
- {
- return adoptRef(new HashChangeEvent(type, initializer));
- }
-
- void initHashChangeEvent(const AtomicString& eventType, bool canBubble, bool cancelable, const String& oldURL, const String& newURL)
- {
- if (dispatched())
- return;
-
- initEvent(eventType, canBubble, cancelable);
-
- m_oldURL = oldURL;
- m_newURL = newURL;
- }
-
- const String& oldURL() const { return m_oldURL; }
- const String& newURL() const { return m_newURL; }
-
- virtual const AtomicString& interfaceName() const { return eventNames().interfaceForHashChangeEvent; }
-
-private:
- HashChangeEvent()
- {
- ScriptWrappable::init(this);
- }
-
- HashChangeEvent(const String& oldURL, const String& newURL)
- : Event(eventNames().hashchangeEvent, false, false)
- , m_oldURL(oldURL)
- , m_newURL(newURL)
- {
- ScriptWrappable::init(this);
- }
-
- HashChangeEvent(const AtomicString& type, const HashChangeEventInit& initializer)
- : Event(type, initializer)
- , m_oldURL(initializer.oldURL)
- , m_newURL(initializer.newURL)
- {
- ScriptWrappable::init(this);
- }
-
- String m_oldURL;
- String m_newURL;
-};
-
-} // namespace WebCore
-
-#endif // HashChangeEvent_h
diff --git a/Source/core/dom/HashChangeEvent.idl b/Source/core/dom/HashChangeEvent.idl
deleted file mode 100644
index 470a208..0000000
--- a/Source/core/dom/HashChangeEvent.idl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2010 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-// Introduced in http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#event-hashchange
-[
- ConstructorTemplate=Event
-] interface HashChangeEvent : Event {
- void initHashChangeEvent([Default=Undefined] optional DOMString type,
- [Default=Undefined] optional boolean canBubble,
- [Default=Undefined] optional boolean cancelable,
- [Default=Undefined] optional DOMString oldURL,
- [Default=Undefined] optional DOMString newURL);
- [InitializedByEventConstructor] readonly attribute DOMString oldURL;
- [InitializedByEventConstructor] readonly attribute DOMString newURL;
-};
-
diff --git a/Source/core/dom/KeyboardEvent.cpp b/Source/core/dom/KeyboardEvent.cpp
deleted file mode 100644
index b20d77a..0000000
--- a/Source/core/dom/KeyboardEvent.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/**
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006, 2007 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/KeyboardEvent.h"
-
-#include "core/dom/EventNames.h"
-#include "core/platform/PlatformKeyboardEvent.h"
-#include "core/platform/WindowsKeyboardCodes.h"
-
-namespace WebCore {
-
-static inline const AtomicString& eventTypeForKeyboardEventType(PlatformEvent::Type type)
-{
- switch (type) {
- case PlatformEvent::KeyUp:
- return eventNames().keyupEvent;
- case PlatformEvent::RawKeyDown:
- return eventNames().keydownEvent;
- case PlatformEvent::Char:
- return eventNames().keypressEvent;
- case PlatformEvent::KeyDown:
- // The caller should disambiguate the combined event into RawKeyDown or Char events.
- break;
- default:
- break;
- }
- ASSERT_NOT_REACHED();
- return eventNames().keydownEvent;
-}
-
-static inline int windowsVirtualKeyCodeWithoutLocation(int keycode)
-{
- switch (keycode) {
- case VK_LCONTROL:
- case VK_RCONTROL:
- return VK_CONTROL;
- case VK_LSHIFT:
- case VK_RSHIFT:
- return VK_SHIFT;
- case VK_LMENU:
- case VK_RMENU:
- return VK_MENU;
- default:
- return keycode;
- }
-}
-
-static inline KeyboardEvent::KeyLocationCode keyLocationCode(const PlatformKeyboardEvent& key)
-{
- if (key.isKeypad())
- return KeyboardEvent::DOM_KEY_LOCATION_NUMPAD;
-
- switch (key.windowsVirtualKeyCode()) {
- case VK_LCONTROL:
- case VK_LSHIFT:
- case VK_LMENU:
- case VK_LWIN:
- return KeyboardEvent::DOM_KEY_LOCATION_LEFT;
- case VK_RCONTROL:
- case VK_RSHIFT:
- case VK_RMENU:
- case VK_RWIN:
- return KeyboardEvent::DOM_KEY_LOCATION_RIGHT;
- default:
- return KeyboardEvent::DOM_KEY_LOCATION_STANDARD;
- }
-}
-
-KeyboardEventInit::KeyboardEventInit()
- : location(0)
- , ctrlKey(false)
- , altKey(false)
- , shiftKey(false)
- , metaKey(false)
-{
-}
-
-KeyboardEvent::KeyboardEvent()
- : m_location(DOM_KEY_LOCATION_STANDARD)
- , m_altGraphKey(false)
-{
- ScriptWrappable::init(this);
-}
-
-KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* view)
- : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()),
- true, true, view, 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey())
- , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key)))
- , m_keyIdentifier(key.keyIdentifier())
- , m_location(keyLocationCode(key))
- , m_altGraphKey(false)
-{
- ScriptWrappable::init(this);
-}
-
-KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventInit& initializer)
- : UIEventWithKeyState(eventType, initializer.bubbles, initializer.cancelable, initializer.view, initializer.detail, initializer.ctrlKey, initializer.altKey, initializer.shiftKey, initializer.metaKey)
- , m_keyIdentifier(initializer.keyIdentifier)
- , m_location(initializer.location)
- , m_altGraphKey(false)
-{
- ScriptWrappable::init(this);
-}
-
-KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool cancelable, AbstractView *view,
- const String &keyIdentifier, unsigned location,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey)
- : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, ctrlKey, altKey, shiftKey, metaKey)
- , m_keyIdentifier(keyIdentifier)
- , m_location(location)
- , m_altGraphKey(altGraphKey)
-{
- ScriptWrappable::init(this);
-}
-
-KeyboardEvent::~KeyboardEvent()
-{
-}
-
-void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
- const String &keyIdentifier, unsigned location,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey)
-{
- if (dispatched())
- return;
-
- initUIEvent(type, canBubble, cancelable, view, 0);
-
- m_keyIdentifier = keyIdentifier;
- m_location = location;
- m_ctrlKey = ctrlKey;
- m_shiftKey = shiftKey;
- m_altKey = altKey;
- m_metaKey = metaKey;
- m_altGraphKey = altGraphKey;
-}
-
-bool KeyboardEvent::getModifierState(const String& keyIdentifier) const
-{
- // FIXME: The following keyIdentifiers are not supported yet (crbug.com/265458):
- // "AltGraph", "CapsLock", "Fn", "NumLock", "ScrollLock", "SymbolLock", "OS".
- if (keyIdentifier == "Control")
- return ctrlKey();
- if (keyIdentifier == "Shift")
- return shiftKey();
- if (keyIdentifier == "Alt")
- return altKey();
- if (keyIdentifier == "Meta")
- return metaKey();
- return false;
-}
-
-int KeyboardEvent::keyCode() const
-{
- // IE: virtual key code for keyup/keydown, character code for keypress
- // Firefox: virtual key code for keyup/keydown, zero for keypress
- // We match IE.
- if (!m_keyEvent)
- return 0;
- if (type() == eventNames().keydownEvent || type() == eventNames().keyupEvent)
- return windowsVirtualKeyCodeWithoutLocation(m_keyEvent->windowsVirtualKeyCode());
-
- return charCode();
-}
-
-int KeyboardEvent::charCode() const
-{
- // IE: not supported
- // Firefox: 0 for keydown/keyup events, character code for keypress
- // We match Firefox
-
- if (!m_keyEvent || (type() != eventNames().keypressEvent))
- return 0;
- String text = m_keyEvent->text();
- return static_cast<int>(text.characterStartingAt(0));
-}
-
-const AtomicString& KeyboardEvent::interfaceName() const
-{
- return eventNames().interfaceForKeyboardEvent;
-}
-
-bool KeyboardEvent::isKeyboardEvent() const
-{
- return true;
-}
-
-int KeyboardEvent::which() const
-{
- // Netscape's "which" returns a virtual key code for keydown and keyup, and a character code for keypress.
- // That's exactly what IE's "keyCode" returns. So they are the same for keyboard events.
- return keyCode();
-}
-
-KeyboardEvent* findKeyboardEvent(Event* event)
-{
- for (Event* e = event; e; e = e->underlyingEvent()) {
- if (e->isKeyboardEvent())
- return toKeyboardEvent(e);
- }
- return 0;
-}
-
-PassRefPtr<KeyboardEventDispatchMediator> KeyboardEventDispatchMediator::create(PassRefPtr<KeyboardEvent> event)
-{
- return adoptRef(new KeyboardEventDispatchMediator(event));
-}
-
-KeyboardEventDispatchMediator::KeyboardEventDispatchMediator(PassRefPtr<KeyboardEvent> event)
- : EventDispatchMediator(event)
-{
-}
-
-bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
- // Make sure not to return true if we already took default action while handling the event.
- return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->defaultHandled();
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/KeyboardEvent.h b/Source/core/dom/KeyboardEvent.h
deleted file mode 100644
index 3cbeb06..0000000
--- a/Source/core/dom/KeyboardEvent.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef KeyboardEvent_h
-#define KeyboardEvent_h
-
-#include "core/dom/EventDispatchMediator.h"
-#include "core/dom/UIEventWithKeyState.h"
-
-namespace WebCore {
-
-class EventDispatcher;
-class Node;
-class PlatformKeyboardEvent;
-
-struct KeyboardEventInit : public UIEventInit {
- KeyboardEventInit();
-
- String keyIdentifier;
- unsigned location;
- bool ctrlKey;
- bool altKey;
- bool shiftKey;
- bool metaKey;
-};
-
-class KeyboardEvent : public UIEventWithKeyState {
-public:
- enum KeyLocationCode {
- DOM_KEY_LOCATION_STANDARD = 0x00,
- DOM_KEY_LOCATION_LEFT = 0x01,
- DOM_KEY_LOCATION_RIGHT = 0x02,
- DOM_KEY_LOCATION_NUMPAD = 0x03
- };
-
- static PassRefPtr<KeyboardEvent> create()
- {
- return adoptRef(new KeyboardEvent);
- }
-
- static PassRefPtr<KeyboardEvent> create(const PlatformKeyboardEvent& platformEvent, AbstractView* view)
- {
- return adoptRef(new KeyboardEvent(platformEvent, view));
- }
-
- static PassRefPtr<KeyboardEvent> create(const AtomicString& type, const KeyboardEventInit& initializer)
- {
- return adoptRef(new KeyboardEvent(type, initializer));
- }
-
- static PassRefPtr<KeyboardEvent> create(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
- const String& keyIdentifier, unsigned location,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey)
- {
- return adoptRef(new KeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, location,
- ctrlKey, altKey, shiftKey, metaKey, altGraphKey));
- }
-
- virtual ~KeyboardEvent();
-
- void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView*,
- const String& keyIdentifier, unsigned location,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey = false);
-
- const String& keyIdentifier() const { return m_keyIdentifier; }
- unsigned location() const { return m_location; }
-
- bool getModifierState(const String& keyIdentifier) const;
-
- bool altGraphKey() const { return m_altGraphKey; }
-
- const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); }
-
- int keyCode() const; // key code for keydown and keyup, character for keypress
- int charCode() const; // character code for keypress, 0 for keydown and keyup
-
- virtual const AtomicString& interfaceName() const;
- virtual bool isKeyboardEvent() const;
- virtual int which() const;
-
-private:
- KeyboardEvent();
- KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*);
- KeyboardEvent(const AtomicString&, const KeyboardEventInit&);
- KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView*,
- const String& keyIdentifier, unsigned location,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey);
-
- OwnPtr<PlatformKeyboardEvent> m_keyEvent;
- String m_keyIdentifier;
- unsigned m_location;
- bool m_altGraphKey : 1;
-};
-
-KeyboardEvent* findKeyboardEvent(Event*);
-
-class KeyboardEventDispatchMediator : public EventDispatchMediator {
-public:
- static PassRefPtr<KeyboardEventDispatchMediator> create(PassRefPtr<KeyboardEvent>);
-private:
- explicit KeyboardEventDispatchMediator(PassRefPtr<KeyboardEvent>);
- virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
-};
-
-inline KeyboardEvent* toKeyboardEvent(Event* event)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(!event || event->isKeyboardEvent());
- return static_cast<KeyboardEvent*>(event);
-}
-
-} // namespace WebCore
-
-#endif // KeyboardEvent_h
diff --git a/Source/core/dom/KeyboardEvent.idl b/Source/core/dom/KeyboardEvent.idl
deleted file mode 100644
index 62dd799..0000000
--- a/Source/core/dom/KeyboardEvent.idl
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-[
- ConstructorTemplate=Event
-] interface KeyboardEvent : UIEvent {
- const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00;
- const unsigned long DOM_KEY_LOCATION_LEFT = 0x01;
- const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02;
- const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03;
-
- [InitializedByEventConstructor] readonly attribute DOMString keyIdentifier;
- [InitializedByEventConstructor] readonly attribute unsigned long location;
- [ImplementedAs=location, DeprecateAs=KeyboardEventKeyLocation, InitializedByEventConstructor] readonly attribute unsigned long keyLocation; // Deprecated.
- [InitializedByEventConstructor] readonly attribute boolean ctrlKey;
- [InitializedByEventConstructor] readonly attribute boolean shiftKey;
- [InitializedByEventConstructor] readonly attribute boolean altKey;
- [InitializedByEventConstructor] readonly attribute boolean metaKey;
- readonly attribute boolean altGraphKey;
-
- boolean getModifierState(DOMString keyArgument);
-
- // FIXME: this does not match the version in the DOM spec.
- void initKeyboardEvent([Default=Undefined] optional DOMString type,
- [Default=Undefined] optional boolean canBubble,
- [Default=Undefined] optional boolean cancelable,
- [Default=Undefined] optional Window view,
- [Default=Undefined] optional DOMString keyIdentifier,
- [Default=Undefined] optional unsigned long location,
- [Default=Undefined] optional boolean ctrlKey,
- [Default=Undefined] optional boolean altKey,
- [Default=Undefined] optional boolean shiftKey,
- [Default=Undefined] optional boolean metaKey,
- [Default=Undefined] optional boolean altGraphKey);
-};
-
diff --git a/Source/core/dom/MessageEvent.cpp b/Source/core/dom/MessageEvent.cpp
deleted file mode 100644
index 351275c..0000000
--- a/Source/core/dom/MessageEvent.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2007 Henry Mason (hmason@mac.com)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008 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 "core/dom/MessageEvent.h"
-
-#include "core/dom/EventNames.h"
-#include "core/page/DOMWindow.h"
-
-namespace WebCore {
-
-static inline bool isValidSource(EventTarget* source)
-{
- return !source || source->toDOMWindow() || source->toMessagePort();
-}
-
-MessageEventInit::MessageEventInit()
-{
-}
-
-MessageEvent::MessageEvent()
- : m_dataType(DataTypeScriptValue)
-{
- ScriptWrappable::init(this);
-}
-
-MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& initializer)
- : Event(type, initializer)
- , m_dataType(DataTypeScriptValue)
- , m_origin(initializer.origin)
- , m_lastEventId(initializer.lastEventId)
- , m_source(isValidSource(initializer.source.get()) ? initializer.source : 0)
- , m_ports(adoptPtr(new MessagePortArray(initializer.ports)))
-{
- ScriptWrappable::init(this);
- ASSERT(isValidSource(m_source.get()));
-}
-
-MessageEvent::MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray> ports)
- : Event(eventNames().messageEvent, false, false)
- , m_dataType(DataTypeScriptValue)
- , m_origin(origin)
- , m_lastEventId(lastEventId)
- , m_source(source)
- , m_ports(ports)
-{
- ScriptWrappable::init(this);
- ASSERT(isValidSource(m_source.get()));
-}
-
-MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray> ports)
- : Event(eventNames().messageEvent, false, false)
- , m_dataType(DataTypeSerializedScriptValue)
- , m_dataAsSerializedScriptValue(data)
- , m_origin(origin)
- , m_lastEventId(lastEventId)
- , m_source(source)
- , m_ports(ports)
-{
- ScriptWrappable::init(this);
- if (m_dataAsSerializedScriptValue)
- m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptContext();
- ASSERT(isValidSource(m_source.get()));
-}
-
-MessageEvent::MessageEvent(const String& data, const String& origin)
- : Event(eventNames().messageEvent, false, false)
- , m_dataType(DataTypeString)
- , m_dataAsString(data)
- , m_origin(origin)
- , m_lastEventId("")
-{
- ScriptWrappable::init(this);
-}
-
-MessageEvent::MessageEvent(PassRefPtr<Blob> data, const String& origin)
- : Event(eventNames().messageEvent, false, false)
- , m_dataType(DataTypeBlob)
- , m_dataAsBlob(data)
- , m_origin(origin)
- , m_lastEventId("")
-{
- ScriptWrappable::init(this);
-}
-
-MessageEvent::MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin)
- : Event(eventNames().messageEvent, false, false)
- , m_dataType(DataTypeArrayBuffer)
- , m_dataAsArrayBuffer(data)
- , m_origin(origin)
- , m_lastEventId("")
-{
- ScriptWrappable::init(this);
-}
-
-MessageEvent::~MessageEvent()
-{
-}
-
-void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
-{
- if (dispatched())
- return;
-
- initEvent(type, canBubble, cancelable);
-
- m_dataType = DataTypeScriptValue;
- m_origin = origin;
- m_lastEventId = lastEventId;
- m_source = source;
- m_ports = ports;
-}
-
-void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
-{
- if (dispatched())
- return;
-
- initEvent(type, canBubble, cancelable);
-
- m_dataType = DataTypeSerializedScriptValue;
- m_dataAsSerializedScriptValue = data;
- m_origin = origin;
- m_lastEventId = lastEventId;
- m_source = source;
- m_ports = ports;
-
- if (m_dataAsSerializedScriptValue)
- m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptContext();
-}
-
-const AtomicString& MessageEvent::interfaceName() const
-{
- return eventNames().interfaceForMessageEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/MessageEvent.h b/Source/core/dom/MessageEvent.h
deleted file mode 100644
index e6647c1..0000000
--- a/Source/core/dom/MessageEvent.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2007 Henry Mason (hmason@mac.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 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 MessageEvent_h
-#define MessageEvent_h
-
-#include "bindings/v8/SerializedScriptValue.h"
-#include "core/dom/Event.h"
-#include "core/dom/EventTarget.h"
-#include "core/dom/MessagePort.h"
-#include "core/fileapi/Blob.h"
-#include "core/page/DOMWindow.h"
-#include "wtf/ArrayBuffer.h"
-
-namespace WebCore {
-
-struct MessageEventInit : public EventInit {
- MessageEventInit();
-
- String origin;
- String lastEventId;
- RefPtr<EventTarget> source;
- MessagePortArray ports;
-};
-
-class MessageEvent : public Event {
-public:
- static PassRefPtr<MessageEvent> create()
- {
- return adoptRef(new MessageEvent);
- }
- static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const String& origin = "", const String& lastEventId = "", PassRefPtr<EventTarget> source = 0)
- {
- return adoptRef(new MessageEvent(origin, lastEventId, source, ports));
- }
- static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, const String& origin = "", const String& lastEventId = "", PassRefPtr<EventTarget> source = 0)
- {
- return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports));
- }
- static PassRefPtr<MessageEvent> create(const String& data, const String& origin = "")
- {
- return adoptRef(new MessageEvent(data, origin));
- }
- static PassRefPtr<MessageEvent> create(PassRefPtr<Blob> data, const String& origin = "")
- {
- return adoptRef(new MessageEvent(data, origin));
- }
- static PassRefPtr<MessageEvent> create(PassRefPtr<ArrayBuffer> data, const String& origin = "")
- {
- return adoptRef(new MessageEvent(data, origin));
- }
- static PassRefPtr<MessageEvent> create(const AtomicString& type, const MessageEventInit& initializer)
- {
- return adoptRef(new MessageEvent(type, initializer));
- }
- virtual ~MessageEvent();
-
- void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
- void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
-
- const String& origin() const { return m_origin; }
- const String& lastEventId() const { return m_lastEventId; }
- EventTarget* source() const { return m_source.get(); }
- MessagePortArray ports() const { return m_ports ? *m_ports : MessagePortArray(); }
-
- virtual const AtomicString& interfaceName() const;
-
- enum DataType {
- DataTypeScriptValue,
- DataTypeSerializedScriptValue,
- DataTypeString,
- DataTypeBlob,
- DataTypeArrayBuffer
- };
- DataType dataType() const { return m_dataType; }
- SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue || m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get(); }
- String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m_dataAsString; }
- Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_dataAsBlob.get(); }
- ArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArrayBuffer); return m_dataAsArrayBuffer.get(); }
-
- void setSerializedData(PassRefPtr<SerializedScriptValue> data)
- {
- ASSERT(!m_dataAsSerializedScriptValue);
- m_dataAsSerializedScriptValue = data;
- }
-
-private:
- MessageEvent();
- MessageEvent(const AtomicString&, const MessageEventInit&);
- MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray>);
- MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray>);
-
- explicit MessageEvent(const String& data, const String& origin);
- explicit MessageEvent(PassRefPtr<Blob> data, const String& origin);
- explicit MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin);
-
- DataType m_dataType;
- RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue;
- String m_dataAsString;
- RefPtr<Blob> m_dataAsBlob;
- RefPtr<ArrayBuffer> m_dataAsArrayBuffer;
- String m_origin;
- String m_lastEventId;
- RefPtr<EventTarget> m_source;
- OwnPtr<MessagePortArray> m_ports;
-};
-
-} // namespace WebCore
-
-#endif // MessageEvent_h
diff --git a/Source/core/dom/MessageEvent.idl b/Source/core/dom/MessageEvent.idl
deleted file mode 100644
index 33d1c33..0000000
--- a/Source/core/dom/MessageEvent.idl
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2007 Henry Mason <hmason@mac.com>
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 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.
- *
- */
-
-[
- GlobalContext=Window&WorkerGlobalScope,
- ConstructorTemplate=Event
-] interface MessageEvent : Event {
- [InitializedByEventConstructor] readonly attribute DOMString origin;
- [InitializedByEventConstructor] readonly attribute DOMString lastEventId;
- [InitializedByEventConstructor] readonly attribute EventTarget source; // May be a Window or a MessagePort
- [InitializedByEventConstructor, CustomGetter] readonly attribute any data;
- [InitializedByEventConstructor] readonly attribute MessagePort[] ports;
-
- [Custom] void initMessageEvent([Default=Undefined] optional DOMString typeArg,
- [Default=Undefined] optional boolean canBubbleArg,
- [Default=Undefined] optional boolean cancelableArg,
- [Default=Undefined] optional any dataArg,
- [Default=Undefined] optional DOMString originArg,
- [Default=Undefined] optional DOMString lastEventIdArg,
- [Default=Undefined] optional Window sourceArg,
- [Default=Undefined] optional Array messagePorts);
-
- [Custom] void webkitInitMessageEvent([Default=Undefined] optional DOMString typeArg,
- [Default=Undefined] optional boolean canBubbleArg,
- [Default=Undefined] optional boolean cancelableArg,
- [Default=Undefined] optional any dataArg,
- [Default=Undefined] optional DOMString originArg,
- [Default=Undefined] optional DOMString lastEventIdArg,
- [Default=Undefined] optional Window sourceArg,
- [Default=Undefined] optional Array transferables);
-};
-
diff --git a/Source/core/dom/MessagePort.cpp b/Source/core/dom/MessagePort.cpp
index 9b3f1cd..b626623 100644
--- a/Source/core/dom/MessagePort.cpp
+++ b/Source/core/dom/MessagePort.cpp
@@ -30,9 +30,9 @@
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/dom/Document.h"
-#include "core/dom/EventNames.h"
+#include "core/events/EventNames.h"
#include "core/dom/ExceptionCode.h"
-#include "core/dom/MessageEvent.h"
+#include "core/events/MessageEvent.h"
#include "core/page/DOMWindow.h"
#include "core/workers/WorkerGlobalScope.h"
#include "wtf/text/AtomicString.h"
@@ -69,7 +69,7 @@
for (unsigned int i = 0; i < ports->size(); ++i) {
MessagePort* dataPort = (*ports)[i].get();
if (dataPort == this || m_entangledChannel->isConnectedTo(dataPort)) {
- es.throwDOMException(DataCloneError);
+ es.throwUninformativeAndGenericDOMException(DataCloneError);
return;
}
}
@@ -202,7 +202,7 @@
for (unsigned int i = 0; i < ports->size(); ++i) {
MessagePort* port = (*ports)[i].get();
if (!port || port->isNeutered() || portSet.contains(port)) {
- es.throwDOMException(DataCloneError);
+ es.throwUninformativeAndGenericDOMException(DataCloneError);
return nullptr;
}
portSet.add(port);
diff --git a/Source/core/dom/MessagePort.h b/Source/core/dom/MessagePort.h
index 34773c9..53df123 100644
--- a/Source/core/dom/MessagePort.h
+++ b/Source/core/dom/MessagePort.h
@@ -28,8 +28,8 @@
#define MessagePort_h
#include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/EventListener.h"
-#include "core/dom/EventTarget.h"
+#include "core/events/EventListener.h"
+#include "core/events/EventTarget.h"
#include "core/dom/MessagePortChannel.h"
#include "wtf/Forward.h"
#include "wtf/OwnPtr.h"
diff --git a/Source/core/dom/MouseEvent.cpp b/Source/core/dom/MouseEvent.cpp
deleted file mode 100644
index 6ae78a2..0000000
--- a/Source/core/dom/MouseEvent.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/MouseEvent.h"
-
-#include "core/dom/Clipboard.h"
-#include "core/dom/EventDispatcher.h"
-#include "core/dom/EventNames.h"
-#include "core/dom/EventRetargeter.h"
-#include "core/platform/PlatformMouseEvent.h"
-
-namespace WebCore {
-
-MouseEventInit::MouseEventInit()
- : screenX(0)
- , screenY(0)
- , clientX(0)
- , clientY(0)
- , ctrlKey(false)
- , altKey(false)
- , shiftKey(false)
- , metaKey(false)
- , button(0)
- , relatedTarget(0)
-{
-}
-
-PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseEventInit& initializer)
-{
- return adoptRef(new MouseEvent(type, initializer));
-}
-
-PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget)
-{
- ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButton);
-
- bool isMouseEnterOrLeave = eventType == eventNames().mouseenterEvent || eventType == eventNames().mouseleaveEvent;
- bool isCancelable = !isMouseEnterOrLeave;
- bool isBubbling = !isMouseEnterOrLeave;
-
- return MouseEvent::create(eventType, isBubbling, isCancelable, view,
- detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
- event.movementDelta().x(), event.movementDelta().y(),
- event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
- relatedTarget, 0, false);
-}
-
-PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
- int detail, int screenX, int screenY, int pageX, int pageY,
- int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
- PassRefPtr<EventTarget> relatedTarget)
-
-{
- return MouseEvent::create(type, canBubble, cancelable, view,
- detail, screenX, screenY, pageX, pageY,
- movementX, movementY,
- ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, 0, false);
-}
-
-PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
- int detail, int screenX, int screenY, int pageX, int pageY,
- int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
- PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard> clipboard, bool isSimulated)
-{
- return adoptRef(new MouseEvent(type, canBubble, cancelable, view,
- detail, screenX, screenY, pageX, pageY,
- movementX, movementY,
- ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, clipboard, isSimulated));
-}
-
-MouseEvent::MouseEvent()
- : m_button(0)
- , m_buttonDown(false)
-{
- ScriptWrappable::init(this);
-}
-
-MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
- int detail, int screenX, int screenY, int pageX, int pageY,
- int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
- unsigned short button, PassRefPtr<EventTarget> relatedTarget,
- PassRefPtr<Clipboard> clipboard, bool isSimulated)
- : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint(screenX, screenY),
- IntPoint(pageX, pageY),
- IntPoint(movementX, movementY),
- ctrlKey, altKey, shiftKey, metaKey, isSimulated)
- , m_button(button == (unsigned short)-1 ? 0 : button)
- , m_buttonDown(button != (unsigned short)-1)
- , m_relatedTarget(relatedTarget)
- , m_clipboard(clipboard)
-{
- ScriptWrappable::init(this);
-}
-
-MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& initializer)
- : MouseRelatedEvent(eventType, initializer.bubbles, initializer.cancelable, initializer.view, initializer.detail, IntPoint(initializer.screenX, initializer.screenY),
- IntPoint(0 /* pageX */, 0 /* pageY */),
- IntPoint(0 /* movementX */, 0 /* movementY */),
- initializer.ctrlKey, initializer.altKey, initializer.shiftKey, initializer.metaKey, false /* isSimulated */)
- , m_button(initializer.button == (unsigned short)-1 ? 0 : initializer.button)
- , m_buttonDown(initializer.button != (unsigned short)-1)
- , m_relatedTarget(initializer.relatedTarget)
- , m_clipboard(0 /* clipboard */)
-{
- ScriptWrappable::init(this);
- initCoordinates(IntPoint(initializer.clientX, initializer.clientY));
-}
-
-MouseEvent::~MouseEvent()
-{
-}
-
-void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
- int detail, int screenX, int screenY, int clientX, int clientY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
- unsigned short button, PassRefPtr<EventTarget> relatedTarget)
-{
- if (dispatched())
- return;
-
- initUIEvent(type, canBubble, cancelable, view, detail);
-
- m_screenLocation = IntPoint(screenX, screenY);
- m_ctrlKey = ctrlKey;
- m_altKey = altKey;
- m_shiftKey = shiftKey;
- m_metaKey = metaKey;
- m_button = button == (unsigned short)-1 ? 0 : button;
- m_buttonDown = button != (unsigned short)-1;
- m_relatedTarget = relatedTarget;
-
- initCoordinates(IntPoint(clientX, clientY));
-
- // FIXME: m_isSimulated is not set to false here.
- // FIXME: m_clipboard is not set to 0 here.
-}
-
-const AtomicString& MouseEvent::interfaceName() const
-{
- return eventNames().interfaceForMouseEvent;
-}
-
-bool MouseEvent::isMouseEvent() const
-{
- return true;
-}
-
-bool MouseEvent::isDragEvent() const
-{
- const AtomicString& t = type();
- return t == eventNames().dragenterEvent || t == eventNames().dragoverEvent || t == eventNames().dragleaveEvent || t == eventNames().dropEvent
- || t == eventNames().dragstartEvent|| t == eventNames().dragEvent || t == eventNames().dragendEvent;
-}
-
-int MouseEvent::which() const
-{
- // For the DOM, the return values for left, middle and right mouse buttons are 0, 1, 2, respectively.
- // For the Netscape "which" property, the return values for left, middle and right mouse buttons are 1, 2, 3, respectively.
- // So we must add 1.
- if (!m_buttonDown)
- return 0;
- return m_button + 1;
-}
-
-Node* MouseEvent::toElement() const
-{
- // MSIE extension - "the object toward which the user is moving the mouse pointer"
- if (type() == eventNames().mouseoutEvent || type() == eventNames().mouseleaveEvent)
- return relatedTarget() ? relatedTarget()->toNode() : 0;
-
- return target() ? target()->toNode() : 0;
-}
-
-Node* MouseEvent::fromElement() const
-{
- // MSIE extension - "object from which activation or the mouse pointer is exiting during the event" (huh?)
- if (type() != eventNames().mouseoutEvent && type() != eventNames().mouseleaveEvent)
- return relatedTarget() ? relatedTarget()->toNode() : 0;
-
- return target() ? target()->toNode() : 0;
-}
-
-PassRefPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent)
-{
- return adoptRef(new SimulatedMouseEvent(eventType, view, underlyingEvent));
-}
-
-SimulatedMouseEvent::~SimulatedMouseEvent()
-{
-}
-
-SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent)
- : MouseEvent(eventType, true, true, view, 0, 0, 0, 0, 0,
- 0, 0,
- false, false, false, false, 0, 0, 0, true)
-{
- if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEvent.get())) {
- m_ctrlKey = keyStateEvent->ctrlKey();
- m_altKey = keyStateEvent->altKey();
- m_shiftKey = keyStateEvent->shiftKey();
- m_metaKey = keyStateEvent->metaKey();
- }
- setUnderlyingEvent(underlyingEvent);
-
- if (this->underlyingEvent() && this->underlyingEvent()->isMouseEvent()) {
- MouseEvent* mouseEvent = toMouseEvent(this->underlyingEvent());
- m_screenLocation = mouseEvent->screenLocation();
- initCoordinates(mouseEvent->clientLocation());
- }
-}
-
-PassRefPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::create(PassRefPtr<MouseEvent> mouseEvent, MouseEventType mouseEventType)
-{
- return adoptRef(new MouseEventDispatchMediator(mouseEvent, mouseEventType));
-}
-
-MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtr<MouseEvent> mouseEvent, MouseEventType mouseEventType)
- : EventDispatchMediator(mouseEvent), m_mouseEventType(mouseEventType)
-{
-}
-
-MouseEvent* MouseEventDispatchMediator::event() const
-{
- return toMouseEvent(EventDispatchMediator::event());
-}
-
-bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
- if (isSyntheticMouseEvent()) {
- EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event());
- return dispatcher->dispatch();
- }
-
- if (isDisabledFormControl(dispatcher->node()))
- return false;
-
- if (event()->type().isEmpty())
- return true; // Shouldn't happen.
-
- ASSERT(!event()->target() || event()->target() != event()->relatedTarget());
-
- EventTarget* relatedTarget = event()->relatedTarget();
- EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event());
-
- dispatcher->dispatch();
- bool swallowEvent = event()->defaultHandled() || event()->defaultPrevented();
-
- if (event()->type() != eventNames().clickEvent || event()->detail() != 2)
- return !swallowEvent;
-
- // Special case: If it's a double click event, we also send the dblclick event. This is not part
- // of the DOM specs, but is used for compatibility with the ondblclick="" attribute. This is treated
- // as a separate event in other DOM-compliant browsers like Firefox, and so we do the same.
- RefPtr<MouseEvent> doubleClickEvent = MouseEvent::create();
- doubleClickEvent->initMouseEvent(eventNames().dblclickEvent, event()->bubbles(), event()->cancelable(), event()->view(),
- event()->detail(), event()->screenX(), event()->screenY(), event()->clientX(), event()->clientY(),
- event()->ctrlKey(), event()->altKey(), event()->shiftKey(), event()->metaKey(),
- event()->button(), relatedTarget);
- if (event()->defaultHandled())
- doubleClickEvent->setDefaultHandled();
- EventDispatcher::dispatchEvent(dispatcher->node(), MouseEventDispatchMediator::create(doubleClickEvent));
- if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented())
- return false;
- return !swallowEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/MouseEvent.h b/Source/core/dom/MouseEvent.h
deleted file mode 100644
index 5ef39b0..0000000
--- a/Source/core/dom/MouseEvent.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef MouseEvent_h
-#define MouseEvent_h
-
-#include "core/dom/EventDispatchMediator.h"
-#include "core/dom/MouseRelatedEvent.h"
-
-namespace WebCore {
-
-class Clipboard;
-class EventDispatcher;
-class PlatformMouseEvent;
-
-struct MouseEventInit : public UIEventInit {
- MouseEventInit();
-
- int screenX;
- int screenY;
- int clientX;
- int clientY;
- bool ctrlKey;
- bool altKey;
- bool shiftKey;
- bool metaKey;
- unsigned short button;
- RefPtr<EventTarget> relatedTarget;
-};
-
-class MouseEvent : public MouseRelatedEvent {
-public:
- static PassRefPtr<MouseEvent> create()
- {
- return adoptRef(new MouseEvent);
- }
-
- static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
- int detail, int screenX, int screenY, int pageX, int pageY,
- int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
- PassRefPtr<EventTarget> relatedTarget);
-
- static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
- int detail, int screenX, int screenY, int pageX, int pageY,
- int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
- PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard>, bool isSimulated = false);
-
- static PassRefPtr<MouseEvent> create(const AtomicString& eventType, PassRefPtr<AbstractView>, const PlatformMouseEvent&, int detail, PassRefPtr<Node> relatedTarget);
-
- static PassRefPtr<MouseEvent> create(const AtomicString& eventType, const MouseEventInit&);
-
- virtual ~MouseEvent();
-
- void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
- int detail, int screenX, int screenY, int clientX, int clientY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
- unsigned short button, PassRefPtr<EventTarget> relatedTarget);
-
- // WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
- // but we will match the standard DOM.
- unsigned short button() const { return m_button; }
- bool buttonDown() const { return m_buttonDown; }
- EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
- void setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
-
- Clipboard* clipboard() const { return m_clipboard.get(); }
-
- Node* toElement() const;
- Node* fromElement() const;
-
- Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get() : 0; }
-
- virtual const AtomicString& interfaceName() const;
-
- virtual bool isMouseEvent() const;
- virtual bool isDragEvent() const;
- virtual int which() const;
-
-protected:
- MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
- int detail, int screenX, int screenY, int pageX, int pageY,
- int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
- PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard>, bool isSimulated);
-
- MouseEvent(const AtomicString& type, const MouseEventInit&);
-
- MouseEvent();
-
-private:
- unsigned short m_button;
- bool m_buttonDown;
- RefPtr<EventTarget> m_relatedTarget;
- RefPtr<Clipboard> m_clipboard;
-};
-
-class SimulatedMouseEvent : public MouseEvent {
-public:
- static PassRefPtr<SimulatedMouseEvent> create(const AtomicString& eventType, PassRefPtr<AbstractView>, PassRefPtr<Event> underlyingEvent);
- virtual ~SimulatedMouseEvent();
-
-private:
- SimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<AbstractView>, PassRefPtr<Event> underlyingEvent);
-};
-
-class MouseEventDispatchMediator : public EventDispatchMediator {
-public:
- enum MouseEventType { SyntheticMouseEvent, NonSyntheticMouseEvent};
- static PassRefPtr<MouseEventDispatchMediator> create(PassRefPtr<MouseEvent>, MouseEventType = NonSyntheticMouseEvent);
-
-private:
- explicit MouseEventDispatchMediator(PassRefPtr<MouseEvent>, MouseEventType);
- MouseEvent* event() const;
-
- virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
- bool isSyntheticMouseEvent() const { return m_mouseEventType == SyntheticMouseEvent; }
- MouseEventType m_mouseEventType;
-};
-
-inline MouseEvent* toMouseEvent(Event* event)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(!event || event->isMouseEvent());
- return static_cast<MouseEvent*>(event);
-}
-
-} // namespace WebCore
-
-#endif // MouseEvent_h
diff --git a/Source/core/dom/MouseEvent.idl b/Source/core/dom/MouseEvent.idl
deleted file mode 100644
index 92c3bfb..0000000
--- a/Source/core/dom/MouseEvent.idl
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-[
- ConstructorTemplate=Event
-] interface MouseEvent : UIEvent {
- [InitializedByEventConstructor] readonly attribute long screenX;
- [InitializedByEventConstructor] readonly attribute long screenY;
- [InitializedByEventConstructor] readonly attribute long clientX;
- [InitializedByEventConstructor] readonly attribute long clientY;
- [InitializedByEventConstructor] readonly attribute boolean ctrlKey;
- [InitializedByEventConstructor] readonly attribute boolean shiftKey;
- [InitializedByEventConstructor] readonly attribute boolean altKey;
- [InitializedByEventConstructor] readonly attribute boolean metaKey;
- [InitializedByEventConstructor] readonly attribute unsigned short button;
- [InitializedByEventConstructor] readonly attribute EventTarget relatedTarget;
- readonly attribute long webkitMovementX;
- readonly attribute long webkitMovementY;
-
- void initMouseEvent([Default=Undefined] optional DOMString type,
- [Default=Undefined] optional boolean canBubble,
- [Default=Undefined] optional boolean cancelable,
- [Default=Undefined] optional Window view,
- [Default=Undefined] optional long detail,
- [Default=Undefined] optional long screenX,
- [Default=Undefined] optional long screenY,
- [Default=Undefined] optional long clientX,
- [Default=Undefined] optional long clientY,
- [Default=Undefined] optional boolean ctrlKey,
- [Default=Undefined] optional boolean altKey,
- [Default=Undefined] optional boolean shiftKey,
- [Default=Undefined] optional boolean metaKey,
- [Default=Undefined] optional unsigned short button,
- [Default=Undefined] optional EventTarget relatedTarget);
-
- // extensions
- readonly attribute long offsetX;
- readonly attribute long offsetY;
- readonly attribute long x;
- readonly attribute long y;
- readonly attribute Node fromElement;
- readonly attribute Node toElement;
-
- readonly attribute Clipboard dataTransfer;
-};
-
diff --git a/Source/core/dom/MouseRelatedEvent.cpp b/Source/core/dom/MouseRelatedEvent.cpp
deleted file mode 100644
index 147ba2d..0000000
--- a/Source/core/dom/MouseRelatedEvent.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/MouseRelatedEvent.h"
-
-#include "core/dom/Document.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
-#include "core/rendering/RenderLayer.h"
-#include "core/rendering/RenderObject.h"
-
-namespace WebCore {
-
-MouseRelatedEvent::MouseRelatedEvent()
- : m_isSimulated(false)
- , m_hasCachedRelativePosition(false)
-{
-}
-
-static LayoutSize contentsScrollOffset(AbstractView* abstractView)
-{
- if (!abstractView)
- return LayoutSize();
- Frame* frame = abstractView->frame();
- if (!frame)
- return LayoutSize();
- FrameView* frameView = frame->view();
- if (!frameView)
- return LayoutSize();
- float scaleFactor = frame->pageZoomFactor();
- return LayoutSize(frameView->scrollX() / scaleFactor, frameView->scrollY() / scaleFactor);
-}
-
-MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<AbstractView> abstractView,
- int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
- const IntPoint& movementDelta,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated)
- : UIEventWithKeyState(eventType, canBubble, cancelable, abstractView, detail, ctrlKey, altKey, shiftKey, metaKey)
- , m_screenLocation(screenLocation)
- , m_movementDelta(movementDelta)
- , m_isSimulated(isSimulated)
-{
- LayoutPoint adjustedPageLocation;
- LayoutPoint scrollPosition;
-
- Frame* frame = view() ? view()->frame() : 0;
- if (frame && !isSimulated) {
- if (FrameView* frameView = frame->view()) {
- scrollPosition = frameView->scrollPosition();
- adjustedPageLocation = frameView->windowToContents(windowLocation);
- float scaleFactor = 1 / frame->pageZoomFactor();
- if (scaleFactor != 1.0f) {
- adjustedPageLocation.scale(scaleFactor, scaleFactor);
- scrollPosition.scale(scaleFactor, scaleFactor);
- }
- }
- }
-
- m_clientLocation = adjustedPageLocation - toLayoutSize(scrollPosition);
- m_pageLocation = adjustedPageLocation;
-
- initCoordinates();
-}
-
-void MouseRelatedEvent::initCoordinates()
-{
- // Set up initial values for coordinates.
- // Correct values are computed lazily, see computeRelativePosition.
- m_layerLocation = m_pageLocation;
- m_offsetLocation = m_pageLocation;
-
- computePageLocation();
- m_hasCachedRelativePosition = false;
-}
-
-void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation)
-{
- // Set up initial values for coordinates.
- // Correct values are computed lazily, see computeRelativePosition.
- m_clientLocation = clientLocation;
- m_pageLocation = clientLocation + contentsScrollOffset(view());
-
- m_layerLocation = m_pageLocation;
- m_offsetLocation = m_pageLocation;
-
- computePageLocation();
- m_hasCachedRelativePosition = false;
-}
-
-static float pageZoomFactor(const UIEvent* event)
-{
- DOMWindow* window = event->view();
- if (!window)
- return 1;
- Frame* frame = window->frame();
- if (!frame)
- return 1;
- return frame->pageZoomFactor();
-}
-
-void MouseRelatedEvent::computePageLocation()
-{
- float scaleFactor = pageZoomFactor(this);
- setAbsoluteLocation(roundedLayoutPoint(FloatPoint(pageX() * scaleFactor, pageY() * scaleFactor)));
-}
-
-void MouseRelatedEvent::receivedTarget()
-{
- m_hasCachedRelativePosition = false;
-}
-
-void MouseRelatedEvent::computeRelativePosition()
-{
- Node* targetNode = target() ? target()->toNode() : 0;
- if (!targetNode)
- return;
-
- // Compute coordinates that are based on the target.
- m_layerLocation = m_pageLocation;
- m_offsetLocation = m_pageLocation;
-
- // Must have an updated render tree for this math to work correctly.
- targetNode->document().updateLayoutIgnorePendingStylesheets();
-
- // Adjust offsetLocation to be relative to the target's position.
- if (RenderObject* r = targetNode->renderer()) {
- FloatPoint localPos = r->absoluteToLocal(absoluteLocation(), UseTransforms);
- m_offsetLocation = roundedLayoutPoint(localPos);
- float scaleFactor = 1 / pageZoomFactor(this);
- if (scaleFactor != 1.0f)
- m_offsetLocation.scale(scaleFactor, scaleFactor);
- }
-
- // Adjust layerLocation to be relative to the layer.
- // FIXME: event.layerX and event.layerY are poorly defined,
- // and probably don't always correspond to RenderLayer offsets.
- // https://bugs.webkit.org/show_bug.cgi?id=21868
- Node* n = targetNode;
- while (n && !n->renderer())
- n = n->parentNode();
-
- RenderLayer* layer;
- if (n && (layer = n->renderer()->enclosingLayer())) {
- for (; layer; layer = layer->parent()) {
- m_layerLocation -= toLayoutSize(layer->location());
- }
- }
-
- m_hasCachedRelativePosition = true;
-}
-
-int MouseRelatedEvent::layerX()
-{
- if (!m_hasCachedRelativePosition)
- computeRelativePosition();
- return m_layerLocation.x();
-}
-
-int MouseRelatedEvent::layerY()
-{
- if (!m_hasCachedRelativePosition)
- computeRelativePosition();
- return m_layerLocation.y();
-}
-
-int MouseRelatedEvent::offsetX()
-{
- if (!m_hasCachedRelativePosition)
- computeRelativePosition();
- return roundToInt(m_offsetLocation.x());
-}
-
-int MouseRelatedEvent::offsetY()
-{
- if (!m_hasCachedRelativePosition)
- computeRelativePosition();
- return roundToInt(m_offsetLocation.y());
-}
-
-int MouseRelatedEvent::pageX() const
-{
- return m_pageLocation.x();
-}
-
-int MouseRelatedEvent::pageY() const
-{
- return m_pageLocation.y();
-}
-
-const LayoutPoint& MouseRelatedEvent::pageLocation() const
-{
- return m_pageLocation;
-}
-
-int MouseRelatedEvent::x() const
-{
- // FIXME: This is not correct.
- // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events.html>.
- return m_clientLocation.x();
-}
-
-int MouseRelatedEvent::y() const
-{
- // FIXME: This is not correct.
- // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events.html>.
- return m_clientLocation.y();
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/MouseRelatedEvent.h b/Source/core/dom/MouseRelatedEvent.h
deleted file mode 100644
index a33ddf8..0000000
--- a/Source/core/dom/MouseRelatedEvent.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef MouseRelatedEvent_h
-#define MouseRelatedEvent_h
-
-#include "core/dom/UIEventWithKeyState.h"
-#include "core/platform/graphics/LayoutPoint.h"
-
-namespace WebCore {
-
- // Internal only: Helper class for what's common between mouse and wheel events.
- class MouseRelatedEvent : public UIEventWithKeyState {
- public:
- // Note that these values are adjusted to counter the effects of zoom, so that values
- // exposed via DOM APIs are invariant under zooming.
- int screenX() const { return m_screenLocation.x(); }
- int screenY() const { return m_screenLocation.y(); }
- const IntPoint& screenLocation() const { return m_screenLocation; }
- int clientX() const { return m_clientLocation.x(); }
- int clientY() const { return m_clientLocation.y(); }
- int webkitMovementX() const { return m_movementDelta.x(); }
- int webkitMovementY() const { return m_movementDelta.y(); }
- const LayoutPoint& clientLocation() const { return m_clientLocation; }
- int layerX();
- int layerY();
- int offsetX();
- int offsetY();
- bool isSimulated() const { return m_isSimulated; }
- virtual int pageX() const;
- virtual int pageY() const;
- virtual const LayoutPoint& pageLocation() const;
- int x() const;
- int y() const;
-
- // Page point in "absolute" coordinates (i.e. post-zoomed, page-relative coords,
- // usable with RenderObject::absoluteToLocal).
- const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; }
- void setAbsoluteLocation(const LayoutPoint& p) { m_absoluteLocation = p; }
-
- protected:
- MouseRelatedEvent();
- MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
- int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
- const IntPoint& movementDelta,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated = false);
-
- void initCoordinates();
- void initCoordinates(const LayoutPoint& clientLocation);
- virtual void receivedTarget();
-
- void computePageLocation();
- void computeRelativePosition();
-
- // Expose these so MouseEvent::initMouseEvent can set them.
- IntPoint m_screenLocation;
- LayoutPoint m_clientLocation;
- LayoutPoint m_movementDelta;
-
- private:
- LayoutPoint m_pageLocation;
- LayoutPoint m_layerLocation;
- LayoutPoint m_offsetLocation;
- LayoutPoint m_absoluteLocation;
- bool m_isSimulated;
- bool m_hasCachedRelativePosition;
- };
-
-} // namespace WebCore
-
-#endif // MouseRelatedEvent_h
diff --git a/Source/core/dom/MutationEvent.cpp b/Source/core/dom/MutationEvent.cpp
deleted file mode 100644
index fcb19b9..0000000
--- a/Source/core/dom/MutationEvent.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/MutationEvent.h"
-
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-MutationEvent::MutationEvent()
- : m_attrChange(0)
-{
- ScriptWrappable::init(this);
-}
-
-MutationEvent::MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
- const String& prevValue, const String& newValue,
- const String& attrName, unsigned short attrChange)
- : Event(type, canBubble, cancelable)
- , m_relatedNode(relatedNode)
- , m_prevValue(prevValue)
- , m_newValue(newValue)
- , m_attrName(attrName)
- , m_attrChange(attrChange)
-{
- ScriptWrappable::init(this);
-}
-
-MutationEvent::~MutationEvent()
-{
-}
-
-void MutationEvent::initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
- const String& prevValue, const String& newValue,
- const String& attrName, unsigned short attrChange)
-{
- if (dispatched())
- return;
-
- initEvent(type, canBubble, cancelable);
-
- m_relatedNode = relatedNode;
- m_prevValue = prevValue;
- m_newValue = newValue;
- m_attrName = attrName;
- m_attrChange = attrChange;
-}
-
-const AtomicString& MutationEvent::interfaceName() const
-{
- return eventNames().interfaceForMutationEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/MutationEvent.h b/Source/core/dom/MutationEvent.h
deleted file mode 100644
index 15e3da1..0000000
--- a/Source/core/dom/MutationEvent.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef MutationEvent_h
-#define MutationEvent_h
-
-#include "core/dom/Event.h"
-#include "core/dom/Node.h"
-
-namespace WebCore {
-
- class MutationEvent : public Event {
- public:
- virtual ~MutationEvent();
-
- enum attrChangeType {
- MODIFICATION = 1,
- ADDITION = 2,
- REMOVAL = 3
- };
-
- static PassRefPtr<MutationEvent> create()
- {
- return adoptRef(new MutationEvent);
- }
-
- static PassRefPtr<MutationEvent> create(const AtomicString& type, bool canBubble, PassRefPtr<Node> relatedNode = 0,
- const String& prevValue = String(), const String& newValue = String(), const String& attrName = String(), unsigned short attrChange = 0)
- {
- return adoptRef(new MutationEvent(type, canBubble, false, relatedNode, prevValue, newValue, attrName, attrChange));
- }
-
- void initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
- const String& prevValue, const String& newValue,
- const String& attrName, unsigned short attrChange);
-
- Node* relatedNode() const { return m_relatedNode.get(); }
- String prevValue() const { return m_prevValue; }
- String newValue() const { return m_newValue; }
- String attrName() const { return m_attrName; }
- unsigned short attrChange() const { return m_attrChange; }
-
- virtual const AtomicString& interfaceName() const;
-
- private:
- MutationEvent();
- MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
- const String& prevValue, const String& newValue,
- const String& attrName, unsigned short attrChange);
-
- RefPtr<Node> m_relatedNode;
- String m_prevValue;
- String m_newValue;
- String m_attrName;
- unsigned short m_attrChange;
- };
-
-} // namespace WebCore
-
-#endif // MutationEvent_h
diff --git a/Source/core/dom/MutationEvent.idl b/Source/core/dom/MutationEvent.idl
deleted file mode 100644
index 0aae4e3..0000000
--- a/Source/core/dom/MutationEvent.idl
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-// Introduced in DOM Level 2:
-interface MutationEvent : Event {
-
- // attrChangeType
- const unsigned short MODIFICATION = 1;
- const unsigned short ADDITION = 2;
- const unsigned short REMOVAL = 3;
-
- readonly attribute Node relatedNode;
- readonly attribute DOMString prevValue;
- readonly attribute DOMString newValue;
- readonly attribute DOMString attrName;
- readonly attribute unsigned short attrChange;
-
- void initMutationEvent([Default=Undefined] optional DOMString type,
- [Default=Undefined] optional boolean canBubble,
- [Default=Undefined] optional boolean cancelable,
- [Default=Undefined] optional Node relatedNode,
- [Default=Undefined] optional DOMString prevValue,
- [Default=Undefined] optional DOMString newValue,
- [Default=Undefined] optional DOMString attrName,
- [Default=Undefined] optional unsigned short attrChange);
-
-};
-
diff --git a/Source/core/dom/MutationObserver.cpp b/Source/core/dom/MutationObserver.cpp
index e2d5fec..36d1100 100644
--- a/Source/core/dom/MutationObserver.cpp
+++ b/Source/core/dom/MutationObserver.cpp
@@ -84,7 +84,7 @@
void MutationObserver::observe(Node* node, const Dictionary& optionsDictionary, ExceptionState& es)
{
if (!node) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -111,7 +111,7 @@
options |= AttributeFilter;
if (!validateOptions(options)) {
- es.throwDOMException(SyntaxError);
+ es.throwUninformativeAndGenericDOMException(SyntaxError);
return;
}
diff --git a/Source/core/dom/NamedFlow.cpp b/Source/core/dom/NamedFlow.cpp
index 013b0eb..36c3952 100644
--- a/Source/core/dom/NamedFlow.cpp
+++ b/Source/core/dom/NamedFlow.cpp
@@ -31,10 +31,10 @@
#include "core/dom/NamedFlow.h"
#include "RuntimeEnabledFeatures.h"
-#include "core/dom/EventNames.h"
+#include "core/events/EventNames.h"
#include "core/dom/NamedFlowCollection.h"
#include "core/dom/StaticNodeList.h"
-#include "core/dom/UIEvent.h"
+#include "core/events/UIEvent.h"
#include "core/rendering/RenderNamedFlowThread.h"
#include "core/rendering/RenderRegion.h"
diff --git a/Source/core/dom/NamedFlow.h b/Source/core/dom/NamedFlow.h
index 13306cc..1bc5ce3 100644
--- a/Source/core/dom/NamedFlow.h
+++ b/Source/core/dom/NamedFlow.h
@@ -31,7 +31,7 @@
#define NamedFlow_h
#include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/EventTarget.h"
+#include "core/events/EventTarget.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
#include "wtf/text/AtomicString.h"
diff --git a/Source/core/dom/NamedNodeMap.cpp b/Source/core/dom/NamedNodeMap.cpp
index 1e2d022..6bce778 100644
--- a/Source/core/dom/NamedNodeMap.cpp
+++ b/Source/core/dom/NamedNodeMap.cpp
@@ -62,9 +62,9 @@
PassRefPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& name, ExceptionState& es)
{
- size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex(name, shouldIgnoreAttributeCase(m_element)) : notFound;
- if (index == notFound) {
- es.throwDOMException(NotFoundError);
+ size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex(name, shouldIgnoreAttributeCase(m_element)) : kNotFound;
+ if (index == kNotFound) {
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return 0;
}
return m_element->detachAttribute(index);
@@ -72,9 +72,9 @@
PassRefPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionState& es)
{
- size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex(QualifiedName(nullAtom, localName, namespaceURI)) : notFound;
- if (index == notFound) {
- es.throwDOMException(NotFoundError);
+ size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex(QualifiedName(nullAtom, localName, namespaceURI)) : kNotFound;
+ if (index == kNotFound) {
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return 0;
}
return m_element->detachAttribute(index);
@@ -83,13 +83,13 @@
PassRefPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionState& es)
{
if (!node) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return 0;
}
// Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node
if (!node->isAttributeNode()) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return 0;
}
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index f6a2d3e..e299a9a 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -33,7 +33,7 @@
#include "core/accessibility/AXObjectCache.h"
#include "core/dom/Attr.h"
#include "core/dom/Attribute.h"
-#include "core/dom/BeforeLoadEvent.h"
+#include "core/events/BeforeLoadEvent.h"
#include "core/dom/ChildListMutationScope.h"
#include "core/dom/ChildNodeList.h"
#include "core/dom/ClassNodeList.h"
@@ -43,17 +43,17 @@
#include "core/dom/DocumentType.h"
#include "core/dom/Element.h"
#include "core/dom/ElementRareData.h"
-#include "core/dom/Event.h"
-#include "core/dom/EventDispatchMediator.h"
-#include "core/dom/EventDispatcher.h"
-#include "core/dom/EventListener.h"
-#include "core/dom/EventNames.h"
+#include "core/events/Event.h"
+#include "core/events/EventDispatchMediator.h"
+#include "core/events/EventDispatcher.h"
+#include "core/events/EventListener.h"
+#include "core/events/EventNames.h"
#include "core/dom/ExceptionCode.h"
-#include "core/dom/GestureEvent.h"
-#include "core/dom/KeyboardEvent.h"
+#include "core/events/GestureEvent.h"
+#include "core/events/KeyboardEvent.h"
#include "core/dom/LiveNodeList.h"
-#include "core/dom/MouseEvent.h"
-#include "core/dom/MutationEvent.h"
+#include "core/events/MouseEvent.h"
+#include "core/events/MutationEvent.h"
#include "core/dom/NameNodeList.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/NodeTraversal.h"
@@ -62,14 +62,14 @@
#include "core/dom/TagNodeList.h"
#include "core/dom/TemplateContentDocumentFragment.h"
#include "core/dom/Text.h"
-#include "core/dom/TextEvent.h"
+#include "core/events/TextEvent.h"
#include "core/dom/TouchController.h"
-#include "core/dom/TouchEvent.h"
+#include "core/events/TouchEvent.h"
#include "core/dom/TreeScopeAdopter.h"
-#include "core/dom/UIEvent.h"
+#include "core/events/UIEvent.h"
#include "core/dom/UserActionElementSet.h"
#include "core/dom/WheelController.h"
-#include "core/dom/WheelEvent.h"
+#include "core/events/WheelEvent.h"
#include "core/dom/shadow/ElementShadow.h"
#include "core/dom/shadow/InsertionPoint.h"
#include "core/dom/shadow/ShadowRoot.h"
@@ -461,7 +461,7 @@
if (isContainerNode())
toContainerNode(this)->insertBefore(newChild, refChild, es);
else
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
}
void Node::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionState& es)
@@ -469,7 +469,7 @@
if (isContainerNode())
toContainerNode(this)->replaceChild(newChild, oldChild, es);
else
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
}
void Node::removeChild(Node* oldChild, ExceptionState& es)
@@ -477,7 +477,7 @@
if (isContainerNode())
toContainerNode(this)->removeChild(oldChild, es);
else
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
}
void Node::appendChild(PassRefPtr<Node> newChild, ExceptionState& es)
@@ -485,7 +485,7 @@
if (isContainerNode())
toContainerNode(this)->appendChild(newChild, es);
else
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
}
void Node::remove(ExceptionState& es)
@@ -510,41 +510,10 @@
if (node == this)
break;
- if (type != TEXT_NODE) {
+ if (type == TEXT_NODE)
+ node = toText(node.get())->mergeNextSiblingNodesIfPossible();
+ else
node = NodeTraversal::nextPostOrder(node.get());
- continue;
- }
-
- RefPtr<Text> text = toText(node.get());
-
- // Remove empty text nodes.
- if (!text->length()) {
- // Care must be taken to get the next node before removing the current node.
- node = NodeTraversal::nextPostOrder(node.get());
- text->remove(IGNORE_EXCEPTION);
- continue;
- }
-
- // Merge text nodes.
- while (Node* nextSibling = node->nextSibling()) {
- if (nextSibling->nodeType() != TEXT_NODE)
- break;
- RefPtr<Text> nextText = toText(nextSibling);
-
- // Remove empty text nodes.
- if (!nextText->length()) {
- nextText->remove(IGNORE_EXCEPTION);
- continue;
- }
-
- // Both non-empty text nodes. Merge them.
- unsigned offset = text->length();
- text->appendData(nextText->data());
- document().didMergeTextNodes(nextText.get(), offset);
- nextText->remove(IGNORE_EXCEPTION);
- }
-
- node = NodeTraversal::nextPostOrder(node.get());
}
}
@@ -559,7 +528,7 @@
// The spec says that for nodes other than elements and attributes, prefix is always null.
// It does not say what to do when the user tries to set the prefix on another type of
// node, however Mozilla throws a NamespaceError exception.
- es.throwDOMException(NamespaceError);
+ es.throwUninformativeAndGenericDOMException(NamespaceError);
}
const AtomicString& Node::localName() const
@@ -892,7 +861,7 @@
// Element::setPrefix() and Attr::setPrefix()
if (!prefix.isEmpty() && !Document::isValidName(prefix)) {
- es.throwDOMException(InvalidCharacterError);
+ es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
return;
}
@@ -1301,7 +1270,7 @@
PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, ExceptionState& es)
{
if (selectors.isEmpty()) {
- es.throwDOMException(SyntaxError);
+ es.throwUninformativeAndGenericDOMException(SyntaxError);
return 0;
}
@@ -1314,7 +1283,7 @@
PassRefPtr<NodeList> Node::querySelectorAll(const AtomicString& selectors, ExceptionState& es)
{
if (selectors.isEmpty()) {
- es.throwDOMException(SyntaxError);
+ es.throwUninformativeAndGenericDOMException(SyntaxError);
return 0;
}
@@ -2249,8 +2218,8 @@
return;
size_t index = registry->find(registration);
- ASSERT(index != notFound);
- if (index == notFound)
+ ASSERT(index != kNotFound);
+ if (index == kNotFound)
return;
// Deleting the registration may cause this node to be derefed, so we must make sure the Vector operation completes
diff --git a/Source/core/dom/Node.h b/Source/core/dom/Node.h
index 58738dc..612111e 100644
--- a/Source/core/dom/Node.h
+++ b/Source/core/dom/Node.h
@@ -27,7 +27,7 @@
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/EventTarget.h"
+#include "core/events/EventTarget.h"
#include "core/dom/MutationObserver.h"
#include "core/dom/SimulatedClickOptions.h"
#include "core/dom/TreeScope.h"
diff --git a/Source/core/dom/NodeRenderingContext.cpp b/Source/core/dom/NodeRenderingContext.cpp
index 236ac4f..60d7d94 100644
--- a/Source/core/dom/NodeRenderingContext.cpp
+++ b/Source/core/dom/NodeRenderingContext.cpp
@@ -72,7 +72,7 @@
const Vector<RefPtr<Element> >& topLayerElements = element->document().topLayerElements();
size_t position = topLayerElements.find(element);
- ASSERT(position != notFound);
+ ASSERT(position != kNotFound);
for (size_t i = position + 1; i < topLayerElements.size(); ++i) {
if (RenderObject* renderer = topLayerElements[i]->renderer())
return renderer;
diff --git a/Source/core/dom/OverflowEvent.cpp b/Source/core/dom/OverflowEvent.cpp
deleted file mode 100644
index 63ee454..0000000
--- a/Source/core/dom/OverflowEvent.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 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 "core/dom/OverflowEvent.h"
-
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-OverflowEventInit::OverflowEventInit()
- : orient(0)
- , horizontalOverflow(false)
- , verticalOverflow(false)
-{
-}
-
-OverflowEvent::OverflowEvent()
- : Event(eventNames().overflowchangedEvent, false, false)
- , m_orient(VERTICAL)
- , m_horizontalOverflow(false)
- , m_verticalOverflow(false)
-{
- ScriptWrappable::init(this);
-}
-
-OverflowEvent::OverflowEvent(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow)
- : Event(eventNames().overflowchangedEvent, false, false)
- , m_horizontalOverflow(horizontalOverflow)
- , m_verticalOverflow(verticalOverflow)
-{
- ASSERT(horizontalOverflowChanged || verticalOverflowChanged);
- ScriptWrappable::init(this);
-
- if (horizontalOverflowChanged && verticalOverflowChanged)
- m_orient = BOTH;
- else if (horizontalOverflowChanged)
- m_orient = HORIZONTAL;
- else
- m_orient = VERTICAL;
-}
-
-OverflowEvent::OverflowEvent(const AtomicString& type, const OverflowEventInit& initializer)
- : Event(type, initializer)
- , m_orient(initializer.orient)
- , m_horizontalOverflow(initializer.horizontalOverflow)
- , m_verticalOverflow(initializer.verticalOverflow)
-{
- ScriptWrappable::init(this);
-}
-
-const AtomicString& OverflowEvent::interfaceName() const
-{
- return eventNames().interfaceForOverflowEvent;
-}
-
-void OverflowEvent::initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow)
-{
- if (dispatched())
- return;
-
- m_orient = orient;
- m_horizontalOverflow = horizontalOverflow;
- m_verticalOverflow = verticalOverflow;
-}
-
-}
diff --git a/Source/core/dom/OverflowEvent.h b/Source/core/dom/OverflowEvent.h
deleted file mode 100644
index 7509469..0000000
--- a/Source/core/dom/OverflowEvent.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008 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 OverflowEvent_h
-#define OverflowEvent_h
-
-#include "core/dom/Event.h"
-
-namespace WebCore {
-
-struct OverflowEventInit : public EventInit {
- OverflowEventInit();
-
- unsigned short orient;
- bool horizontalOverflow;
- bool verticalOverflow;
-};
-
-class OverflowEvent : public Event {
-public:
- enum orientType {
- HORIZONTAL = 0,
- VERTICAL = 1,
- BOTH = 2
- };
-
- static PassRefPtr<OverflowEvent> create()
- {
- return adoptRef(new OverflowEvent);
- }
- static PassRefPtr<OverflowEvent> create(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow)
- {
- return adoptRef(new OverflowEvent(horizontalOverflowChanged, horizontalOverflow, verticalOverflowChanged, verticalOverflow));
- }
- static PassRefPtr<OverflowEvent> create(const AtomicString& type, const OverflowEventInit& initializer)
- {
- return adoptRef(new OverflowEvent(type, initializer));
- }
-
- void initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow);
-
- unsigned short orient() const { return m_orient; }
- bool horizontalOverflow() const { return m_horizontalOverflow; }
- bool verticalOverflow() const { return m_verticalOverflow; }
-
- virtual const AtomicString& interfaceName() const;
-
-private:
- OverflowEvent();
- OverflowEvent(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow);
- OverflowEvent(const AtomicString&, const OverflowEventInit&);
-
- unsigned short m_orient;
- bool m_horizontalOverflow;
- bool m_verticalOverflow;
-};
-
-}
-
-#endif // OverflowEvent_h
diff --git a/Source/core/dom/OverflowEvent.idl b/Source/core/dom/OverflowEvent.idl
deleted file mode 100644
index 69adee9..0000000
--- a/Source/core/dom/OverflowEvent.idl
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 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.
- */
-
-[
- ConstructorTemplate=Event
-] interface OverflowEvent : Event {
- const unsigned short HORIZONTAL = 0;
- const unsigned short VERTICAL = 1;
- const unsigned short BOTH = 2;
-
- [InitializedByEventConstructor] readonly attribute unsigned short orient;
- [InitializedByEventConstructor] readonly attribute boolean horizontalOverflow;
- [InitializedByEventConstructor] readonly attribute boolean verticalOverflow;
-};
-
diff --git a/Source/core/dom/PageTransitionEvent.cpp b/Source/core/dom/PageTransitionEvent.cpp
deleted file mode 100644
index b351ef4..0000000
--- a/Source/core/dom/PageTransitionEvent.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 INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/dom/PageTransitionEvent.h"
-
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-PageTransitionEventInit::PageTransitionEventInit()
- : persisted(false)
-{
-}
-
-PageTransitionEvent::PageTransitionEvent()
- : m_persisted(false)
-{
- ScriptWrappable::init(this);
-}
-
-PageTransitionEvent::PageTransitionEvent(const AtomicString& type, bool persisted)
- : Event(type, true, true)
- , m_persisted(persisted)
-{
- ScriptWrappable::init(this);
-}
-
-PageTransitionEvent::PageTransitionEvent(const AtomicString& type, const PageTransitionEventInit& initializer)
- : Event(type, initializer)
- , m_persisted(initializer.persisted)
-{
- ScriptWrappable::init(this);
-}
-
-PageTransitionEvent::~PageTransitionEvent()
-{
-}
-
-const AtomicString& PageTransitionEvent::interfaceName() const
-{
- return eventNames().interfaceForPageTransitionEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/PageTransitionEvent.h b/Source/core/dom/PageTransitionEvent.h
deleted file mode 100644
index 723dfff..0000000
--- a/Source/core/dom/PageTransitionEvent.h
+++ /dev/null
@@ -1,70 +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 INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PageTransitionEvent_h
-#define PageTransitionEvent_h
-
-#include "core/dom/Event.h"
-
-namespace WebCore {
-
-struct PageTransitionEventInit : public EventInit {
- PageTransitionEventInit();
-
- bool persisted;
-};
-
-class PageTransitionEvent : public Event {
-public:
- static PassRefPtr<PageTransitionEvent> create()
- {
- return adoptRef(new PageTransitionEvent);
- }
- static PassRefPtr<PageTransitionEvent> create(const AtomicString& type, bool persisted)
- {
- return adoptRef(new PageTransitionEvent(type, persisted));
- }
- static PassRefPtr<PageTransitionEvent> create(const AtomicString& type, const PageTransitionEventInit& initializer)
- {
- return adoptRef(new PageTransitionEvent(type, initializer));
- }
-
- virtual ~PageTransitionEvent();
-
- virtual const AtomicString& interfaceName() const;
-
- bool persisted() const { return m_persisted; }
-
-private:
- PageTransitionEvent();
- PageTransitionEvent(const AtomicString& type, bool persisted);
- PageTransitionEvent(const AtomicString&, const PageTransitionEventInit&);
-
- bool m_persisted;
-};
-
-} // namespace WebCore
-
-#endif // PageTransitionEvent_h
diff --git a/Source/core/dom/PageTransitionEvent.idl b/Source/core/dom/PageTransitionEvent.idl
deleted file mode 100644
index 47749be..0000000
--- a/Source/core/dom/PageTransitionEvent.idl
+++ /dev/null
@@ -1,31 +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 INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-[
- ConstructorTemplate=Event
-] interface PageTransitionEvent : Event {
- [InitializedByEventConstructor] readonly attribute boolean persisted;
-};
-
diff --git a/Source/core/dom/PopStateEvent.cpp b/Source/core/dom/PopStateEvent.cpp
deleted file mode 100644
index 652d9a2..0000000
--- a/Source/core/dom/PopStateEvent.cpp
+++ /dev/null
@@ -1,83 +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, 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 "core/dom/PopStateEvent.h"
-
-#include "bindings/v8/SerializedScriptValue.h"
-#include "core/dom/EventNames.h"
-#include "core/page/History.h"
-
-namespace WebCore {
-
-PopStateEvent::PopStateEvent()
- : Event(eventNames().popstateEvent, false, true)
- , m_serializedState(0)
- , m_history(0)
-{
- ScriptWrappable::init(this);
-}
-
-PopStateEvent::PopStateEvent(const AtomicString& type, const PopStateEventInit& initializer)
- : Event(type, initializer)
- , m_history(0)
-{
- ScriptWrappable::init(this);
-}
-
-PopStateEvent::PopStateEvent(PassRefPtr<SerializedScriptValue> serializedState, PassRefPtr<History> history)
- : Event(eventNames().popstateEvent, false, true)
- , m_serializedState(serializedState)
- , m_history(history)
-{
- ScriptWrappable::init(this);
-}
-
-PopStateEvent::~PopStateEvent()
-{
-}
-
-PassRefPtr<PopStateEvent> PopStateEvent::create()
-{
- return adoptRef(new PopStateEvent);
-}
-
-PassRefPtr<PopStateEvent> PopStateEvent::create(PassRefPtr<SerializedScriptValue> serializedState, PassRefPtr<History> history)
-{
- return adoptRef(new PopStateEvent(serializedState, history));
-}
-
-PassRefPtr<PopStateEvent> PopStateEvent::create(const AtomicString& type, const PopStateEventInit& initializer)
-{
- return adoptRef(new PopStateEvent(type, initializer));
-}
-
-const AtomicString& PopStateEvent::interfaceName() const
-{
- return eventNames().interfaceForPopStateEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/PopStateEvent.h b/Source/core/dom/PopStateEvent.h
deleted file mode 100644
index 19abdd1..0000000
--- a/Source/core/dom/PopStateEvent.h
+++ /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, 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 PopStateEvent_h
-#define PopStateEvent_h
-
-#include "core/dom/Event.h"
-
-namespace WebCore {
-
-class History;
-class SerializedScriptValue;
-
-typedef EventInit PopStateEventInit;
-
-class PopStateEvent : public Event {
-public:
- virtual ~PopStateEvent();
- static PassRefPtr<PopStateEvent> create();
- static PassRefPtr<PopStateEvent> create(PassRefPtr<SerializedScriptValue>, PassRefPtr<History>);
- static PassRefPtr<PopStateEvent> create(const AtomicString&, const PopStateEventInit&);
-
- SerializedScriptValue* serializedState() const { return m_serializedState.get(); }
- void setSerializedState(PassRefPtr<SerializedScriptValue> state)
- {
- ASSERT(!m_serializedState);
- m_serializedState = state;
- }
- History* history() const { return m_history.get(); }
-
- virtual const AtomicString& interfaceName() const;
-
-private:
- PopStateEvent();
- PopStateEvent(const AtomicString&, const PopStateEventInit&);
- explicit PopStateEvent(PassRefPtr<SerializedScriptValue>, PassRefPtr<History>);
-
- RefPtr<SerializedScriptValue> m_serializedState;
- RefPtr<History> m_history;
-};
-
-} // namespace WebCore
-
-#endif // PopStateEvent_h
diff --git a/Source/core/dom/PopStateEvent.idl b/Source/core/dom/PopStateEvent.idl
deleted file mode 100644
index 20ddbaa..0000000
--- a/Source/core/dom/PopStateEvent.idl
+++ /dev/null
@@ -1,31 +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, 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.
- *
- */
-
-[
- ConstructorTemplate=Event
-] interface PopStateEvent : Event {
- [InitializedByEventConstructor, CustomGetter] readonly attribute any state;
-};
diff --git a/Source/core/dom/Position.cpp b/Source/core/dom/Position.cpp
index 646f305..8d52a1e 100644
--- a/Source/core/dom/Position.cpp
+++ b/Source/core/dom/Position.cpp
@@ -674,7 +674,7 @@
otherBox = otherBox->nextLeafChild();
if (!otherBox)
break;
- if (otherBox == lastTextBox || (otherBox->renderer() == textRenderer && static_cast<InlineTextBox*>(otherBox)->start() > textOffset))
+ if (otherBox == lastTextBox || (otherBox->renderer() == textRenderer && toInlineTextBox(otherBox)->start() > textOffset))
continuesOnNextLine = false;
}
@@ -683,7 +683,7 @@
otherBox = otherBox->prevLeafChild();
if (!otherBox)
break;
- if (otherBox == lastTextBox || (otherBox->renderer() == textRenderer && static_cast<InlineTextBox*>(otherBox)->start() > textOffset))
+ if (otherBox == lastTextBox || (otherBox->renderer() == textRenderer && toInlineTextBox(otherBox)->start() > textOffset))
continuesOnNextLine = false;
}
@@ -798,7 +798,7 @@
otherBox = otherBox->nextLeafChild();
if (!otherBox)
break;
- if (otherBox == lastTextBox || (otherBox->renderer() == textRenderer && static_cast<InlineTextBox*>(otherBox)->start() >= textOffset))
+ if (otherBox == lastTextBox || (otherBox->renderer() == textRenderer && toInlineTextBox(otherBox)->start() >= textOffset))
continuesOnNextLine = false;
}
@@ -807,7 +807,7 @@
otherBox = otherBox->prevLeafChild();
if (!otherBox)
break;
- if (otherBox == lastTextBox || (otherBox->renderer() == textRenderer && static_cast<InlineTextBox*>(otherBox)->start() >= textOffset))
+ if (otherBox == lastTextBox || (otherBox->renderer() == textRenderer && toInlineTextBox(otherBox)->start() >= textOffset))
continuesOnNextLine = false;
}
diff --git a/Source/core/dom/ProgressEvent.cpp b/Source/core/dom/ProgressEvent.cpp
deleted file mode 100644
index da8a3c1..0000000
--- a/Source/core/dom/ProgressEvent.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 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 "core/dom/ProgressEvent.h"
-
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-ProgressEventInit::ProgressEventInit()
- : lengthComputable(false)
- , loaded(0)
- , total(0)
-{
-}
-
-ProgressEvent::ProgressEvent()
- : m_lengthComputable(false)
- , m_loaded(0)
- , m_total(0)
-{
- ScriptWrappable::init(this);
-}
-
-ProgressEvent::ProgressEvent(const AtomicString& type, const ProgressEventInit& initializer)
- : Event(type, initializer)
- , m_lengthComputable(initializer.lengthComputable)
- , m_loaded(initializer.loaded)
- , m_total(initializer.total)
-{
- ScriptWrappable::init(this);
-}
-
-ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total)
- : Event(type, false, true)
- , m_lengthComputable(lengthComputable)
- , m_loaded(loaded)
- , m_total(total)
-{
- ScriptWrappable::init(this);
-}
-
-const AtomicString& ProgressEvent::interfaceName() const
-{
- return eventNames().interfaceForProgressEvent;
-}
-
-}
diff --git a/Source/core/dom/ProgressEvent.h b/Source/core/dom/ProgressEvent.h
deleted file mode 100644
index 035e23e..0000000
--- a/Source/core/dom/ProgressEvent.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 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 ProgressEvent_h
-#define ProgressEvent_h
-
-#include "core/dom/Event.h"
-
-namespace WebCore {
-
-struct ProgressEventInit : public EventInit {
- ProgressEventInit();
-
- bool lengthComputable;
- unsigned long long loaded;
- unsigned long long total;
-};
-
-class ProgressEvent : public Event {
-public:
- static PassRefPtr<ProgressEvent> create()
- {
- return adoptRef(new ProgressEvent);
- }
- static PassRefPtr<ProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total)
- {
- return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
- }
- static PassRefPtr<ProgressEvent> create(const AtomicString& type, const ProgressEventInit& initializer)
- {
- return adoptRef(new ProgressEvent(type, initializer));
- }
-
- bool lengthComputable() const { return m_lengthComputable; }
- unsigned long long loaded() const { return m_loaded; }
- unsigned long long total() const { return m_total; }
-
- virtual const AtomicString& interfaceName() const;
-
-protected:
- ProgressEvent();
- ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total);
- ProgressEvent(const AtomicString&, const ProgressEventInit&);
-
-private:
- bool m_lengthComputable;
- unsigned long long m_loaded;
- unsigned long long m_total;
-};
-}
-
-#endif // ProgressEvent_h
diff --git a/Source/core/dom/ProgressEvent.idl b/Source/core/dom/ProgressEvent.idl
deleted file mode 100644
index d775b88..0000000
--- a/Source/core/dom/ProgressEvent.idl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-[
- ConstructorTemplate=Event
-] interface ProgressEvent : Event {
- [InitializedByEventConstructor] readonly attribute boolean lengthComputable;
- [InitializedByEventConstructor] readonly attribute unsigned long long loaded;
- [InitializedByEventConstructor] readonly attribute unsigned long long total;
-};
-
diff --git a/Source/core/dom/Promise.idl b/Source/core/dom/Promise.idl
index 3413c52..f7fb7ba 100644
--- a/Source/core/dom/Promise.idl
+++ b/Source/core/dom/Promise.idl
@@ -28,7 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-callback PromiseInit = void (PromiseResolver resolver);
+callback PromiseInit = void (any resolve, any reject);
callback AnyCallback = any (optional any value);
[
GlobalContext=Window&WorkerGlobalScope,
@@ -38,11 +38,9 @@
[Custom] Promise then(optional AnyCallback fulfillCallback, optional AnyCallback rejectCallback);
[Custom] Promise catch(optional AnyCallback rejectCallback);
- [Custom] static Promise fulfill(any value);
[Custom] static Promise resolve(any value);
[Custom] static Promise reject(any value);
[Custom] static Promise _any(any... values);
[Custom] static Promise every(any... values);
- [Custom] static Promise some(any... values);
};
diff --git a/Source/core/dom/PromiseResolver.h b/Source/core/dom/PromiseResolver.h
deleted file mode 100644
index 664018a..0000000
--- a/Source/core/dom/PromiseResolver.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-// FIXME: This file should be deleted.
-#ifndef PromiseResolver_h
-#define PromiseResolver_h
-
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-// An empty class. This is here because a generated file use it.
-class PromiseResolver : public RefCounted<PromiseResolver> {
-};
-
-} // namespace WebCore
-
-
-#endif // PromiseResolver_h
diff --git a/Source/core/dom/PromiseResolver.idl b/Source/core/dom/PromiseResolver.idl
deleted file mode 100644
index ab417fa..0000000
--- a/Source/core/dom/PromiseResolver.idl
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-[
- GlobalContext=Window&WorkerGlobalScope,
- EnabledAtRuntime=Promise
-] interface PromiseResolver {
- [Custom] void fulfill(optional any value);
- [Custom] void resolve(optional any value);
- [Custom] void reject(optional any value);
-};
diff --git a/Source/core/dom/PseudoElement.cpp b/Source/core/dom/PseudoElement.cpp
index e397b9b..9c10bd0 100644
--- a/Source/core/dom/PseudoElement.cpp
+++ b/Source/core/dom/PseudoElement.cpp
@@ -62,10 +62,6 @@
setHasCustomStyleCallbacks();
}
-PseudoElement::~PseudoElement()
-{
-}
-
PassRefPtr<RenderStyle> PseudoElement::customStyleForRenderer()
{
return parentOrShadowHostElement()->renderer()->getCachedPseudoStyle(m_pseudoId);
diff --git a/Source/core/dom/PseudoElement.h b/Source/core/dom/PseudoElement.h
index 0bd4984..a0ddf69 100644
--- a/Source/core/dom/PseudoElement.h
+++ b/Source/core/dom/PseudoElement.h
@@ -39,7 +39,6 @@
{
return adoptRef(new PseudoElement(parent, pseudoId));
}
- ~PseudoElement();
virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
@@ -70,6 +69,21 @@
return style && style->display() != NONE && (style->styleType() == BACKDROP || style->contentData() || !style->regionThread().isEmpty());
}
+inline PseudoElement* toPseudoElement(Node* node)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isPseudoElement());
+ return static_cast<PseudoElement*>(node);
+}
+
+inline const PseudoElement* toPseudoElement(const Node* node)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isPseudoElement());
+ return static_cast<const PseudoElement*>(node);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toPseudoElement(const PseudoElement*);
+
} // namespace
#endif
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index a6a6d7d..9c1900a 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -36,7 +36,7 @@
#include "core/dom/NodeTraversal.h"
#include "core/dom/NodeWithIndex.h"
#include "core/dom/ProcessingInstruction.h"
-#include "core/dom/ScopedEventQueue.h"
+#include "core/events/ScopedEventQueue.h"
#include "core/dom/Text.h"
#include "core/editing/TextIterator.h"
#include "core/editing/VisiblePosition.h"
@@ -131,7 +131,7 @@
Node* Range::startContainer(ExceptionState& es) const
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("startContainer", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
@@ -141,7 +141,7 @@
int Range::startOffset(ExceptionState& es) const
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("startOffset", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
@@ -151,7 +151,7 @@
Node* Range::endContainer(ExceptionState& es) const
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("endContainer", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
@@ -161,7 +161,7 @@
int Range::endOffset(ExceptionState& es) const
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("endOffset", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
@@ -171,7 +171,7 @@
Node* Range::commonAncestorContainer(ExceptionState& es) const
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("commonAncestorContainer", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
@@ -192,7 +192,7 @@
bool Range::collapsed(ExceptionState& es) const
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("collapsed", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
@@ -214,12 +214,12 @@
void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionState& es)
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("setStart", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return;
}
if (!refNode) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -242,12 +242,12 @@
void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionState& es)
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("setEnd", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return;
}
if (!refNode) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -282,7 +282,7 @@
void Range::collapse(bool toStart, ExceptionState& es)
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("collapse", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return;
}
@@ -295,12 +295,12 @@
bool Range::isPointInRange(Node* refNode, int offset, ExceptionState& es)
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("isPointInRange", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return false;
}
if (!refNode) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return false;
}
@@ -323,17 +323,17 @@
// refNode node and an offset within the node is before, same as, or after the range respectively.
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("comparePoint", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
if (!refNode) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return 0;
}
if (!refNode->attached() || &refNode->document() != m_ownerDocument) {
- es.throwDOMException(WrongDocumentError);
+ es.throwUninformativeAndGenericDOMException(WrongDocumentError);
return 0;
}
@@ -363,12 +363,12 @@
// before and after(surrounds), or inside the range, respectively
if (!refNode) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return NODE_BEFORE;
}
if (!m_start.container() && refNode->attached()) {
- es.throwDOMException(InvalidStateError);
+ es.throwUninformativeAndGenericDOMException(InvalidStateError);
return NODE_BEFORE;
}
@@ -388,7 +388,7 @@
if (!parentNode) {
// if the node is the top document we should return NODE_BEFORE_AND_AFTER
// but we throw to match firefox behavior
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return NODE_BEFORE;
}
@@ -406,12 +406,12 @@
short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, ExceptionState& es) const
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("compareBoundaryPoints", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
if (!sourceRange) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return 0;
}
@@ -423,7 +423,7 @@
return 0;
if (&thisCont->document() != &sourceCont->document()) {
- es.throwDOMException(WrongDocumentError);
+ es.throwUninformativeAndGenericDOMException(WrongDocumentError);
return 0;
}
@@ -434,7 +434,7 @@
while (sourceTop->parentNode())
sourceTop = sourceTop->parentNode();
if (thisTop != sourceTop) { // in different DocumentFragments
- es.throwDOMException(WrongDocumentError);
+ es.throwUninformativeAndGenericDOMException(WrongDocumentError);
return 0;
}
@@ -449,7 +449,7 @@
return compareBoundaryPoints(m_start, sourceRange->m_end, es);
}
- es.throwDOMException(SyntaxError);
+ es.throwUninformativeAndGenericDOMException(SyntaxError);
return 0;
}
@@ -515,7 +515,7 @@
// ### we need to do a traversal here instead
Node* commonAncestor = commonAncestorContainer(containerA, containerB);
if (!commonAncestor) {
- es.throwDOMException(WrongDocumentError);
+ es.throwUninformativeAndGenericDOMException(WrongDocumentError);
return 0;
}
Node* childA = containerA;
@@ -559,7 +559,7 @@
void Range::deleteContents(ExceptionState& es)
{
- checkDeleteExtract(es);
+ checkDeleteExtract("deleteContents", es);
if (es.hadException())
return;
@@ -573,11 +573,11 @@
// Throw exception if the range is already detached.
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("intersectsNode", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return false;
}
if (!refNode) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return false;
}
@@ -592,7 +592,7 @@
if (!parentNode) {
// if the node is the top document we should return NODE_BEFORE_AND_AFTER
// but we throw to match firefox behavior
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return false;
}
@@ -928,7 +928,7 @@
PassRefPtr<DocumentFragment> Range::extractContents(ExceptionState& es)
{
- checkDeleteExtract(es);
+ checkDeleteExtract("extractContents", es);
if (es.hadException())
return 0;
@@ -938,7 +938,7 @@
PassRefPtr<DocumentFragment> Range::cloneContents(ExceptionState& es)
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("cloneContents", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
@@ -950,12 +950,12 @@
RefPtr<Node> newNode = prpNewNode;
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("insertNode", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return;
}
if (!newNode) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -965,7 +965,7 @@
// an extra one here - if a text node is going to split, it must have a parent to insert into
bool startIsText = m_start.container()->isTextNode();
if (startIsText && !m_start.container()->parentNode()) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
@@ -984,7 +984,7 @@
numNewChildren = 0;
for (Node* c = newNode->firstChild(); c; c = c->nextSibling()) {
if (!checkAgainst->childTypeAllowed(c->nodeType())) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
++numNewChildren;
@@ -992,14 +992,14 @@
} else {
numNewChildren = 1;
if (!checkAgainst->childTypeAllowed(newNodeType)) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
}
for (Node* n = m_start.container(); n; n = n->parentNode()) {
if (n == newNode) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
}
@@ -1010,11 +1010,11 @@
case Node::ENTITY_NODE:
case Node::NOTATION_NODE:
case Node::DOCUMENT_NODE:
- es.throwDOMException(InvalidNodeTypeError);
+ es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return;
default:
if (newNode->isShadowRoot()) {
- es.throwDOMException(InvalidNodeTypeError);
+ es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return;
}
break;
@@ -1055,7 +1055,7 @@
String Range::toString(ExceptionState& es) const
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("toString", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return String();
}
@@ -1095,13 +1095,13 @@
PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& markup, ExceptionState& es)
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("createContextualFragment", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
Node* element = m_start.container()->isElementNode() ? m_start.container() : m_start.container()->parentNode();
if (!element || !element->isHTMLElement()) {
- es.throwDOMException(NotSupportedError);
+ es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
@@ -1117,7 +1117,7 @@
{
// Check first to see if we've already detached:
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("detach", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return;
}
@@ -1133,17 +1133,17 @@
case Node::DOCUMENT_TYPE_NODE:
case Node::ENTITY_NODE:
case Node::NOTATION_NODE:
- es.throwDOMException(InvalidNodeTypeError);
+ es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return 0;
case Node::CDATA_SECTION_NODE:
case Node::COMMENT_NODE:
case Node::TEXT_NODE:
if (static_cast<unsigned>(offset) > toCharacterData(n)->length())
- es.throwDOMException(IndexSizeError);
+ es.throwUninformativeAndGenericDOMException(IndexSizeError);
return 0;
case Node::PROCESSING_INSTRUCTION_NODE:
if (static_cast<unsigned>(offset) > toProcessingInstruction(n)->data().length())
- es.throwDOMException(IndexSizeError);
+ es.throwUninformativeAndGenericDOMException(IndexSizeError);
return 0;
case Node::ATTRIBUTE_NODE:
case Node::DOCUMENT_FRAGMENT_NODE:
@@ -1154,7 +1154,7 @@
return 0;
Node* childBefore = n->childNode(offset - 1);
if (!childBefore)
- es.throwDOMException(IndexSizeError);
+ es.throwUninformativeAndGenericDOMException(IndexSizeError);
return childBefore;
}
}
@@ -1162,15 +1162,15 @@
return 0;
}
-void Range::checkNodeBA(Node* n, ExceptionState& es, const char* methodName) const
+void Range::checkNodeBA(Node* n, const String& methodName, ExceptionState& es) const
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute(methodName, "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return;
}
if (!n) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -1189,7 +1189,7 @@
case Node::DOCUMENT_NODE:
case Node::ENTITY_NODE:
case Node::NOTATION_NODE:
- es.throwDOMException(InvalidNodeTypeError);
+ es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return;
case Node::CDATA_SECTION_NODE:
case Node::COMMENT_NODE:
@@ -1219,7 +1219,7 @@
case Node::PROCESSING_INSTRUCTION_NODE:
case Node::TEXT_NODE:
case Node::XPATH_NAMESPACE_NODE:
- es.throwDOMException(InvalidNodeTypeError);
+ es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return;
}
}
@@ -1227,7 +1227,7 @@
PassRefPtr<Range> Range::cloneRange(ExceptionState& es) const
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("cloneRange", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return 0;
}
@@ -1236,7 +1236,7 @@
void Range::setStartAfter(Node* refNode, ExceptionState& es)
{
- checkNodeBA(refNode, es, "setStartAfter");
+ checkNodeBA(refNode, "setStartAfter", es);
if (es.hadException())
return;
@@ -1245,7 +1245,7 @@
void Range::setEndBefore(Node* refNode, ExceptionState& es)
{
- checkNodeBA(refNode, es, "setEndBefore");
+ checkNodeBA(refNode, "setEndBefore", es);
if (es.hadException())
return;
@@ -1254,7 +1254,7 @@
void Range::setEndAfter(Node* refNode, ExceptionState& es)
{
- checkNodeBA(refNode, es, "setEndAfter");
+ checkNodeBA(refNode, "setEndAfter", es);
if (es.hadException())
return;
@@ -1264,12 +1264,12 @@
void Range::selectNode(Node* refNode, ExceptionState& es)
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("selectNode", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return;
}
if (!refNode) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -1296,7 +1296,7 @@
case Node::DOCUMENT_TYPE_NODE:
case Node::ENTITY_NODE:
case Node::NOTATION_NODE:
- es.throwDOMException(InvalidNodeTypeError);
+ es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return;
}
}
@@ -1315,7 +1315,7 @@
case Node::DOCUMENT_NODE:
case Node::ENTITY_NODE:
case Node::NOTATION_NODE:
- es.throwDOMException(InvalidNodeTypeError);
+ es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return;
}
@@ -1329,12 +1329,12 @@
void Range::selectNodeContents(Node* refNode, ExceptionState& es)
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("selectNodeContents", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return;
}
if (!refNode) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -1355,7 +1355,7 @@
case Node::DOCUMENT_TYPE_NODE:
case Node::ENTITY_NODE:
case Node::NOTATION_NODE:
- es.throwDOMException(InvalidNodeTypeError);
+ es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return;
}
}
@@ -1372,12 +1372,12 @@
RefPtr<Node> newParent = passNewParent;
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("surroundContents", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return;
}
if (!newParent) {
- es.throwDOMException(NotFoundError);
+ es.throwUninformativeAndGenericDOMException(NotFoundError);
return;
}
@@ -1390,7 +1390,7 @@
case Node::DOCUMENT_TYPE_NODE:
case Node::ENTITY_NODE:
case Node::NOTATION_NODE:
- es.throwDOMException(InvalidNodeTypeError);
+ es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
return;
case Node::CDATA_SECTION_NODE:
case Node::COMMENT_NODE:
@@ -1410,12 +1410,12 @@
if (parentOfNewParent->isCharacterDataNode())
parentOfNewParent = parentOfNewParent->parentNode();
if (!parentOfNewParent || !parentOfNewParent->childTypeAllowed(newParent->nodeType())) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
if (newParent->contains(m_start.container())) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
@@ -1430,7 +1430,7 @@
if (endNonTextContainer->nodeType() == Node::TEXT_NODE)
endNonTextContainer = endNonTextContainer->parentNode();
if (startNonTextContainer != endNonTextContainer) {
- es.throwDOMException(InvalidStateError);
+ es.throwUninformativeAndGenericDOMException(InvalidStateError);
return;
}
@@ -1453,17 +1453,17 @@
void Range::setStartBefore(Node* refNode, ExceptionState& es)
{
- checkNodeBA(refNode, es, "setStartBefore");
+ checkNodeBA(refNode, "setStartBefore", es);
if (es.hadException())
return;
setStart(refNode->parentNode(), refNode->nodeIndex(), es);
}
-void Range::checkDeleteExtract(ExceptionState& es)
+void Range::checkDeleteExtract(const String& methodName, ExceptionState& es)
{
if (!m_start.container()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute(methodName, "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
return;
}
@@ -1473,7 +1473,7 @@
Node* pastLast = pastLastNode();
for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(n)) {
if (n->nodeType() == Node::DOCUMENT_TYPE_NODE) {
- es.throwDOMException(HierarchyRequestError);
+ es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return;
}
}
diff --git a/Source/core/dom/Range.h b/Source/core/dom/Range.h
index 8850144..82b716c 100644
--- a/Source/core/dom/Range.h
+++ b/Source/core/dom/Range.h
@@ -156,8 +156,8 @@
void setDocument(Document&);
Node* checkNodeWOffset(Node*, int offset, ExceptionState&) const;
- void checkNodeBA(Node*, ExceptionState&, const char* methodName) const;
- void checkDeleteExtract(ExceptionState&);
+ void checkNodeBA(Node*, const String& methodName, ExceptionState&) const;
+ void checkDeleteExtract(const String& methodName, ExceptionState&);
int maxStartOffset() const;
int maxEndOffset() const;
diff --git a/Source/core/dom/RegisteredEventListener.h b/Source/core/dom/RegisteredEventListener.h
deleted file mode 100644
index 7dde557..0000000
--- a/Source/core/dom/RegisteredEventListener.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef RegisteredEventListener_h
-#define RegisteredEventListener_h
-
-#include "core/dom/EventListener.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
- class RegisteredEventListener {
- public:
- RegisteredEventListener(PassRefPtr<EventListener> listener, bool useCapture)
- : listener(listener)
- , useCapture(useCapture)
- {
- }
-
- RefPtr<EventListener> listener;
- bool useCapture;
- };
-
- inline bool operator==(const RegisteredEventListener& a, const RegisteredEventListener& b)
- {
- return *a.listener == *b.listener && a.useCapture == b.useCapture;
- }
-
-} // namespace WebCore
-
-#endif // RegisteredEventListener_h
diff --git a/Source/core/dom/ResourceProgressEvent.cpp b/Source/core/dom/ResourceProgressEvent.cpp
deleted file mode 100644
index 55310bb..0000000
--- a/Source/core/dom/ResourceProgressEvent.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- * * 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 "core/dom/ResourceProgressEvent.h"
-
-namespace WebCore {
-
-ResourceProgressEvent::ResourceProgressEvent()
-{
- ScriptWrappable::init(this);
-}
-
-ResourceProgressEvent::ResourceProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total, const String& url)
- : ProgressEvent(type, lengthComputable, loaded, total)
- , m_url(url)
-{
- ScriptWrappable::init(this);
-}
-
-const String& ResourceProgressEvent::url() const
-{
- return m_url;
-}
-
-const AtomicString& ResourceProgressEvent::interfaceName() const
-{
- return eventNames().interfaceForResourceProgressEvent;
-}
-
-}
diff --git a/Source/core/dom/ResourceProgressEvent.h b/Source/core/dom/ResourceProgressEvent.h
deleted file mode 100644
index 50e7226..0000000
--- a/Source/core/dom/ResourceProgressEvent.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2013 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 ResourceProgressEvent_h
-#define ResourceProgressEvent_h
-
-#include "core/dom/ProgressEvent.h"
-
-namespace WebCore {
-
-// ResourceProgressEvent is a non-standard class that is simply a ProgressEvent
-// with an additional read-only "url" property containing a string URL. This is
-// used by the Chromium NaCl integration to indicate to which resource the
-// event applies. This is useful because the NaCl integration will download
-// (and translate in the case of PNaCl) multiple binary files. It is not
-// constructable by web content at all, and so does not provide the usual
-// EventInit pattern for Event construction.
-class ResourceProgressEvent : public ProgressEvent {
-public:
- static PassRefPtr<ResourceProgressEvent> create()
- {
- return adoptRef(new ResourceProgressEvent);
- }
- static PassRefPtr<ResourceProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total, const String& url)
- {
- return adoptRef(new ResourceProgressEvent(type, lengthComputable, loaded, total, url));
- }
-
- const String& url() const;
-
- virtual const AtomicString& interfaceName() const;
-
-protected:
- ResourceProgressEvent();
- ResourceProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total, const String& url);
-
-private:
- String m_url;
-};
-
-} // namespace WebCore
-
-#endif // ResourceProgressEvent_h
diff --git a/Source/core/dom/ResourceProgressEvent.idl b/Source/core/dom/ResourceProgressEvent.idl
deleted file mode 100644
index 660b8b1..0000000
--- a/Source/core/dom/ResourceProgressEvent.idl
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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.
- */
-
-// ResourceProgressEvent is a non-standard class that is simply a ProgressEvent
-// with an additional read-only "url" property containing a string URL. This is
-// used by the Chromium NaCl integration to indicate to which resource the
-// event applies. This is useful because the NaCl integration will download
-// (and translate in the case of PNaCl) multiple binary files. It is not
-// constructable by web content at all, and so does not provide the usual
-// EventInit pattern for Event construction.
-[
- NoInterfaceObject,
-] interface ResourceProgressEvent : ProgressEvent {
- readonly attribute DOMString url;
-};
-
diff --git a/Source/core/dom/ScopedEventQueue.cpp b/Source/core/dom/ScopedEventQueue.cpp
deleted file mode 100644
index 8072c59..0000000
--- a/Source/core/dom/ScopedEventQueue.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/dom/ScopedEventQueue.h"
-
-#include "core/dom/Event.h"
-#include "core/dom/EventDispatchMediator.h"
-#include "core/dom/EventDispatcher.h"
-#include "core/dom/EventTarget.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-ScopedEventQueue* ScopedEventQueue::s_instance = 0;
-
-ScopedEventQueue::ScopedEventQueue()
- : m_scopingLevel(0)
-{
-}
-
-ScopedEventQueue::~ScopedEventQueue()
-{
- ASSERT(!m_scopingLevel);
- ASSERT(!m_queuedEventDispatchMediators.size());
-}
-
-void ScopedEventQueue::initialize()
-{
- ASSERT(!s_instance);
- OwnPtr<ScopedEventQueue> instance = adoptPtr(new ScopedEventQueue);
- s_instance = instance.leakPtr();
-}
-
-void ScopedEventQueue::enqueueEventDispatchMediator(PassRefPtr<EventDispatchMediator> mediator)
-{
- if (m_scopingLevel)
- m_queuedEventDispatchMediators.append(mediator);
- else
- dispatchEvent(mediator);
-}
-
-void ScopedEventQueue::dispatchAllEvents()
-{
- Vector<RefPtr<EventDispatchMediator> > queuedEventDispatchMediators;
- queuedEventDispatchMediators.swap(m_queuedEventDispatchMediators);
-
- for (size_t i = 0; i < queuedEventDispatchMediators.size(); i++)
- dispatchEvent(queuedEventDispatchMediators[i].release());
-}
-
-void ScopedEventQueue::dispatchEvent(PassRefPtr<EventDispatchMediator> mediator) const
-{
- ASSERT(mediator->event()->target());
- Node* node = mediator->event()->target()->toNode();
- EventDispatcher::dispatchEvent(node, mediator);
-}
-
-ScopedEventQueue* ScopedEventQueue::instance()
-{
- if (!s_instance)
- initialize();
-
- return s_instance;
-}
-
-void ScopedEventQueue::incrementScopingLevel()
-{
- m_scopingLevel++;
-}
-
-void ScopedEventQueue::decrementScopingLevel()
-{
- ASSERT(m_scopingLevel);
- m_scopingLevel--;
- if (!m_scopingLevel)
- dispatchAllEvents();
-}
-
-}
diff --git a/Source/core/dom/ScopedEventQueue.h b/Source/core/dom/ScopedEventQueue.h
deleted file mode 100644
index 4f3c928..0000000
--- a/Source/core/dom/ScopedEventQueue.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ScopedEventQueue_h
-#define ScopedEventQueue_h
-
-#include "wtf/Noncopyable.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class EventDispatchMediator;
-
-class ScopedEventQueue {
- WTF_MAKE_NONCOPYABLE(ScopedEventQueue); WTF_MAKE_FAST_ALLOCATED;
-public:
- ~ScopedEventQueue();
-
- void enqueueEventDispatchMediator(PassRefPtr<EventDispatchMediator>);
- void dispatchAllEvents();
- static ScopedEventQueue* instance();
-
- void incrementScopingLevel();
- void decrementScopingLevel();
-
-private:
- ScopedEventQueue();
- static void initialize();
- void dispatchEvent(PassRefPtr<EventDispatchMediator>) const;
-
- Vector<RefPtr<EventDispatchMediator> > m_queuedEventDispatchMediators;
- unsigned m_scopingLevel;
-
- static ScopedEventQueue* s_instance;
-};
-
-class EventQueueScope {
- WTF_MAKE_NONCOPYABLE(EventQueueScope);
-
-public:
- EventQueueScope() { ScopedEventQueue::instance()->incrementScopingLevel(); }
- ~EventQueueScope() { ScopedEventQueue::instance()->decrementScopingLevel(); }
-};
-
-}
-
-#endif // ScopedEventQueue_h
diff --git a/Source/core/dom/ScriptExecutionContext.cpp b/Source/core/dom/ScriptExecutionContext.cpp
index 9ac54d9..bc013a3 100644
--- a/Source/core/dom/ScriptExecutionContext.cpp
+++ b/Source/core/dom/ScriptExecutionContext.cpp
@@ -29,8 +29,8 @@
#include "core/dom/ScriptExecutionContext.h"
#include "core/dom/ContextLifecycleNotifier.h"
-#include "core/dom/ErrorEvent.h"
-#include "core/dom/EventTarget.h"
+#include "core/events/ErrorEvent.h"
+#include "core/events/EventTarget.h"
#include "core/dom/MessagePort.h"
#include "core/html/PublicURLManager.h"
#include "core/inspector/InspectorInstrumentation.h"
diff --git a/Source/core/dom/ScriptExecutionContext.h b/Source/core/dom/ScriptExecutionContext.h
index a595aa1..2f52840 100644
--- a/Source/core/dom/ScriptExecutionContext.h
+++ b/Source/core/dom/ScriptExecutionContext.h
@@ -29,7 +29,7 @@
#define ScriptExecutionContext_h
#include "core/dom/ActiveDOMObject.h"
-#include "core/dom/ErrorEvent.h"
+#include "core/events/ErrorEvent.h"
#include "core/dom/SecurityContext.h"
#include "core/fetch/CrossOriginAccessControl.h"
#include "core/page/ConsoleTypes.h"
diff --git a/Source/core/dom/ScriptLoader.cpp b/Source/core/dom/ScriptLoader.cpp
index 0345ad9..d39efef 100644
--- a/Source/core/dom/ScriptLoader.cpp
+++ b/Source/core/dom/ScriptLoader.cpp
@@ -29,7 +29,7 @@
#include "bindings/v8/ScriptController.h"
#include "bindings/v8/ScriptSourceCode.h"
#include "core/dom/Document.h"
-#include "core/dom/Event.h"
+#include "core/events/Event.h"
#include "core/dom/IgnoreDestructiveWriteCountIncrementer.h"
#include "core/dom/ScriptLoaderClient.h"
#include "core/dom/ScriptRunner.h"
diff --git a/Source/core/dom/SecurityContext.cpp b/Source/core/dom/SecurityContext.cpp
index f1375e0..c81e923 100644
--- a/Source/core/dom/SecurityContext.cpp
+++ b/Source/core/dom/SecurityContext.cpp
@@ -94,12 +94,12 @@
unsigned numberOfTokenErrors = 0;
StringBuilder tokenErrors;
while (true) {
- while (start < length && isHTMLSpace(policy[start]))
+ while (start < length && isHTMLSpace<UChar>(policy[start]))
++start;
if (start >= length)
break;
unsigned end = start + 1;
- while (end < length && !isHTMLSpace(policy[end]))
+ while (end < length && !isHTMLSpace<UChar>(policy[end]))
++end;
// Turn off the corresponding sandbox flag if it's set as "allowed".
diff --git a/Source/core/dom/SecurityPolicyViolationEvent.h b/Source/core/dom/SecurityPolicyViolationEvent.h
deleted file mode 100644
index 40ff41b..0000000
--- a/Source/core/dom/SecurityPolicyViolationEvent.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 SecurityPolicyViolationEvent_h
-#define SecurityPolicyViolationEvent_h
-
-#include "core/dom/Event.h"
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-struct SecurityPolicyViolationEventInit : public EventInit {
- SecurityPolicyViolationEventInit()
- {
- }
-
- String documentURI;
- String referrer;
- String blockedURI;
- String violatedDirective;
- String effectiveDirective;
- String originalPolicy;
- String sourceFile;
- int lineNumber;
- int columnNumber;
- int statusCode;
-};
-
-class SecurityPolicyViolationEvent : public Event {
-public:
- static PassRefPtr<SecurityPolicyViolationEvent> create()
- {
- return adoptRef(new SecurityPolicyViolationEvent());
- }
-
- static PassRefPtr<SecurityPolicyViolationEvent> create(const AtomicString& type, const SecurityPolicyViolationEventInit& initializer)
- {
- return adoptRef(new SecurityPolicyViolationEvent(type, initializer));
- }
-
- const String& documentURI() const { return m_documentURI; }
- const String& referrer() const { return m_referrer; }
- const String& blockedURI() const { return m_blockedURI; }
- const String& violatedDirective() const { return m_violatedDirective; }
- const String& effectiveDirective() const { return m_effectiveDirective; }
- const String& originalPolicy() const { return m_originalPolicy; }
- const String& sourceFile() const { return m_sourceFile; }
- int lineNumber() const { return m_lineNumber; }
- int columnNumber() const { return m_columnNumber; }
- int statusCode() const { return m_statusCode; }
-
- virtual const AtomicString& interfaceName() const { return eventNames().interfaceForSecurityPolicyViolationEvent; }
-
-private:
- SecurityPolicyViolationEvent()
- {
- ScriptWrappable::init(this);
- }
-
- SecurityPolicyViolationEvent(const AtomicString& type, const SecurityPolicyViolationEventInit& initializer)
- : Event(type, initializer)
- , m_documentURI(initializer.documentURI)
- , m_referrer(initializer.referrer)
- , m_blockedURI(initializer.blockedURI)
- , m_violatedDirective(initializer.violatedDirective)
- , m_effectiveDirective(initializer.effectiveDirective)
- , m_originalPolicy(initializer.originalPolicy)
- , m_sourceFile(initializer.sourceFile)
- , m_lineNumber(initializer.lineNumber)
- , m_columnNumber(initializer.columnNumber)
- , m_statusCode(initializer.statusCode)
- {
- ScriptWrappable::init(this);
- }
-
- String m_documentURI;
- String m_referrer;
- String m_blockedURI;
- String m_violatedDirective;
- String m_effectiveDirective;
- String m_originalPolicy;
- String m_sourceFile;
- int m_lineNumber;
- int m_columnNumber;
- int m_statusCode;
-};
-
-} // namespace WebCore
-
-#endif // SecurityPolicyViolationEvent_h
diff --git a/Source/core/dom/SecurityPolicyViolationEvent.idl b/Source/core/dom/SecurityPolicyViolationEvent.idl
deleted file mode 100644
index d067fab..0000000
--- a/Source/core/dom/SecurityPolicyViolationEvent.idl
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
- */
-
-[
- EnabledAtRuntime=ExperimentalContentSecurityPolicyFeatures,
- ConstructorTemplate=Event
-] interface SecurityPolicyViolationEvent : Event {
- [InitializedByEventConstructor] readonly attribute DOMString documentURI;
- [InitializedByEventConstructor] readonly attribute DOMString referrer;
- [InitializedByEventConstructor] readonly attribute DOMString blockedURI;
- [InitializedByEventConstructor] readonly attribute DOMString violatedDirective;
- [InitializedByEventConstructor] readonly attribute DOMString effectiveDirective;
- [InitializedByEventConstructor] readonly attribute DOMString originalPolicy;
- [InitializedByEventConstructor] readonly attribute DOMString sourceFile;
- [InitializedByEventConstructor] readonly attribute long lineNumber;
- [InitializedByEventConstructor] readonly attribute long columnNumber;
- [InitializedByEventConstructor] readonly attribute long statusCode;
-};
diff --git a/Source/core/dom/SpaceSplitString.cpp b/Source/core/dom/SpaceSplitString.cpp
index 29222d4..63c3da1 100644
--- a/Source/core/dom/SpaceSplitString.cpp
+++ b/Source/core/dom/SpaceSplitString.cpp
@@ -57,12 +57,12 @@
{
unsigned start = 0;
while (true) {
- while (start < length && isHTMLSpace(characters[start]))
+ while (start < length && isHTMLSpace<CharacterType>(characters[start]))
++start;
if (start >= length)
break;
unsigned end = start + 1;
- while (end < length && isNotHTMLSpace(characters[end]))
+ while (end < length && isNotHTMLSpace<CharacterType>(characters[end]))
++end;
m_vector.append(AtomicString(characters + start, end - start));
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index 744c15d..5c300c5 100644
--- a/Source/core/dom/Text.cpp
+++ b/Source/core/dom/Text.cpp
@@ -30,7 +30,8 @@
#include "core/dom/ExceptionCode.h"
#include "core/dom/NodeRenderStyle.h"
#include "core/dom/NodeRenderingContext.h"
-#include "core/dom/ScopedEventQueue.h"
+#include "core/dom/NodeTraversal.h"
+#include "core/events/ScopedEventQueue.h"
#include "core/dom/shadow/ShadowRoot.h"
#include "core/rendering/RenderCombineText.h"
#include "core/rendering/RenderText.h"
@@ -52,6 +53,50 @@
return adoptRef(new Text(document, data, CreateEditingText));
}
+PassRefPtr<Node> Text::mergeNextSiblingNodesIfPossible()
+{
+ RefPtr<Node> protect(this);
+
+ // Remove empty text nodes.
+ if (!length()) {
+ // Care must be taken to get the next node before removing the current node.
+ RefPtr<Node> nextNode(NodeTraversal::nextPostOrder(this));
+ remove(IGNORE_EXCEPTION);
+ return nextNode.release();
+ }
+
+ // Merge text nodes.
+ while (Node* nextSibling = this->nextSibling()) {
+ if (nextSibling->nodeType() != TEXT_NODE)
+ break;
+
+ RefPtr<Text> nextText = toText(nextSibling);
+
+ // Remove empty text nodes.
+ if (!nextText->length()) {
+ nextText->remove(IGNORE_EXCEPTION);
+ continue;
+ }
+
+ // Both non-empty text nodes. Merge them.
+ unsigned offset = length();
+ String nextTextData = nextText->data();
+ String oldTextData = data();
+ setDataWithoutUpdate(data() + nextTextData);
+ updateTextRenderer(oldTextData.length(), 0);
+ // Empty nextText for layout update.
+ nextText->setDataWithoutUpdate(emptyString());
+ document().didMergeTextNodes(nextText.get(), offset);
+ // Restore nextText for mutation event.
+ nextText->setDataWithoutUpdate(nextTextData);
+ document().incDOMTreeVersion();
+ didModifyData(oldTextData);
+ nextText->remove(IGNORE_EXCEPTION);
+ }
+
+ return NodeTraversal::nextPostOrder(this);
+}
+
PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionState& es)
{
// IndexSizeError: Raised if the specified offset is negative or greater than
diff --git a/Source/core/dom/Text.h b/Source/core/dom/Text.h
index b9929c9..df95ff1 100644
--- a/Source/core/dom/Text.h
+++ b/Source/core/dom/Text.h
@@ -39,6 +39,9 @@
static PassRefPtr<Text> createWithLengthLimit(Document&, const String&, unsigned positionInString, unsigned lengthLimit = defaultLengthLimit);
static PassRefPtr<Text> createEditingText(Document&, const String&);
+ // mergeNextSiblingNodesIfPossible() merges next sibling nodes if possible
+ // then returns a node not merged.
+ PassRefPtr<Node> mergeNextSiblingNodesIfPossible();
PassRefPtr<Text> splitText(unsigned offset, ExceptionState&);
// DOM Level 3: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1312295772
diff --git a/Source/core/dom/TextEvent.cpp b/Source/core/dom/TextEvent.cpp
deleted file mode 100644
index e3ee3c8..0000000
--- a/Source/core/dom/TextEvent.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2007 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 "core/dom/TextEvent.h"
-
-#include "core/dom/DocumentFragment.h"
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-PassRefPtr<TextEvent> TextEvent::create()
-{
- return adoptRef(new TextEvent);
-}
-
-PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType)
-{
- 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, shouldSmartReplace, false));
-}
-
-PassRefPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool 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, TextEventInputDrop));
-}
-
-TextEvent::TextEvent()
- : m_inputType(TextEventInputKeyboard)
- , m_shouldSmartReplace(false)
- , m_shouldMatchStyle(false)
-{
- ScriptWrappable::init(this);
-}
-
-TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType)
- : UIEvent(eventNames().textInputEvent, true, true, view, 0)
- , m_inputType(inputType)
- , m_data(data)
- , m_pastingFragment(0)
- , m_shouldSmartReplace(false)
- , m_shouldMatchStyle(false)
-{
- ScriptWrappable::init(this);
-}
-
-TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, PassRefPtr<DocumentFragment> pastingFragment,
- bool shouldSmartReplace, bool shouldMatchStyle)
- : UIEvent(eventNames().textInputEvent, true, true, view, 0)
- , m_inputType(TextEventInputPaste)
- , m_data(data)
- , m_pastingFragment(pastingFragment)
- , m_shouldSmartReplace(shouldSmartReplace)
- , m_shouldMatchStyle(shouldMatchStyle)
-{
- ScriptWrappable::init(this);
-}
-
-TextEvent::~TextEvent()
-{
-}
-
-void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, const String& data)
-{
- if (dispatched())
- return;
-
- initUIEvent(type, canBubble, cancelable, view, 0);
-
- m_data = data;
-}
-
-const AtomicString& TextEvent::interfaceName() const
-{
- return eventNames().interfaceForTextEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/TextEvent.h b/Source/core/dom/TextEvent.h
deleted file mode 100644
index c0dcb69..0000000
--- a/Source/core/dom/TextEvent.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 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 TextEvent_h
-#define TextEvent_h
-
-#include "core/dom/TextEventInputType.h"
-#include "core/dom/UIEvent.h"
-
-namespace WebCore {
-
- class DocumentFragment;
-
- class TextEvent : public UIEvent {
- public:
-
- static PassRefPtr<TextEvent> create();
- static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard);
- static PassRefPtr<TextEvent> createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace);
- static PassRefPtr<TextEvent> createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle);
- static PassRefPtr<TextEvent> createForDrop(PassRefPtr<AbstractView> view, const String& data);
-
- virtual ~TextEvent();
-
- void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, const String& data);
-
- String data() const { return m_data; }
-
- virtual const AtomicString& interfaceName() const;
-
- bool isLineBreak() const { return m_inputType == TextEventInputLineBreak; }
- bool isComposition() const { return m_inputType == TextEventInputComposition; }
- bool isBackTab() const { return m_inputType == TextEventInputBackTab; }
- bool isPaste() const { return m_inputType == TextEventInputPaste; }
- bool isDrop() const { return m_inputType == TextEventInputDrop; }
-
- bool shouldSmartReplace() const { return m_shouldSmartReplace; }
- bool shouldMatchStyle() const { return m_shouldMatchStyle; }
- DocumentFragment* pastingFragment() const { return m_pastingFragment.get(); }
-
- private:
- TextEvent();
-
- TextEvent(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard);
- TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment>,
- bool shouldSmartReplace, bool shouldMatchStyle);
-
- TextEventInputType m_inputType;
- String m_data;
-
- RefPtr<DocumentFragment> m_pastingFragment;
- bool m_shouldSmartReplace;
- bool m_shouldMatchStyle;
- };
-
-} // namespace WebCore
-
-#endif // TextEvent_h
diff --git a/Source/core/dom/TextEvent.idl b/Source/core/dom/TextEvent.idl
deleted file mode 100644
index 3d03594e..0000000
--- a/Source/core/dom/TextEvent.idl
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-// Introduced in DOM Level 3:
-interface TextEvent : UIEvent {
-
- readonly attribute DOMString data;
-
- void initTextEvent([Default=Undefined] optional DOMString typeArg,
- [Default=Undefined] optional boolean canBubbleArg,
- [Default=Undefined] optional boolean cancelableArg,
- [Default=Undefined] optional Window viewArg,
- [Default=Undefined] optional DOMString dataArg);
-
-};
-
diff --git a/Source/core/dom/TextEventInputType.h b/Source/core/dom/TextEventInputType.h
deleted file mode 100644
index fc98a6c..0000000
--- a/Source/core/dom/TextEventInputType.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2010 Google, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TextEventInputType_h
-#define TextEventInputType_h
-
-namespace WebCore {
-
-enum TextEventInputType {
- TextEventInputKeyboard, // any newline characters in the text are line breaks only, not paragraph separators.
- TextEventInputLineBreak, // any tab characters in the text are backtabs.
- TextEventInputComposition,
- TextEventInputBackTab,
- TextEventInputPaste,
- TextEventInputDrop,
- TextEventInputDictation,
- TextEventInputOther,
-};
-
-} // namespace WebCore
-
-#endif // TextEventInputType_h
diff --git a/Source/core/dom/Touch.h b/Source/core/dom/Touch.h
index bc2c28a..f068a2f 100644
--- a/Source/core/dom/Touch.h
+++ b/Source/core/dom/Touch.h
@@ -27,7 +27,7 @@
#define Touch_h
#include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/EventTarget.h"
+#include "core/events/EventTarget.h"
#include "core/platform/graphics/LayoutPoint.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
diff --git a/Source/core/dom/TouchController.cpp b/Source/core/dom/TouchController.cpp
index ce730d2..2680158 100644
--- a/Source/core/dom/TouchController.cpp
+++ b/Source/core/dom/TouchController.cpp
@@ -27,8 +27,8 @@
#include "core/dom/TouchController.h"
#include "core/dom/Document.h"
-#include "core/dom/EventNames.h"
-#include "core/dom/TouchEvent.h"
+#include "core/events/EventNames.h"
+#include "core/events/TouchEvent.h"
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
#include "core/page/Frame.h"
diff --git a/Source/core/dom/TouchController.h b/Source/core/dom/TouchController.h
index 24d1ae1..e444816 100644
--- a/Source/core/dom/TouchController.h
+++ b/Source/core/dom/TouchController.h
@@ -27,7 +27,7 @@
#define TouchController_h
#include "core/dom/DocumentLifecycleObserver.h"
-#include "core/dom/Event.h"
+#include "core/events/Event.h"
#include "core/dom/Node.h"
#include "core/page/DOMWindowLifecycleObserver.h"
#include "core/platform/Supplementable.h"
diff --git a/Source/core/dom/TouchEvent.cpp b/Source/core/dom/TouchEvent.cpp
deleted file mode 100644
index 019a5b5..0000000
--- a/Source/core/dom/TouchEvent.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- * Copyright (C) 2012 Research In Motion Limited. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "core/dom/TouchEvent.h"
-
-#include "core/dom/EventDispatcher.h"
-#include "core/dom/EventNames.h"
-#include "core/dom/EventRetargeter.h"
-#include "core/dom/TouchList.h"
-
-namespace WebCore {
-
-TouchEvent::TouchEvent()
-{
- ScriptWrappable::init(this);
-}
-
-TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches,
- TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
- : MouseRelatedEvent(type, true, true, view, 0, IntPoint(screenX, screenY),
- IntPoint(pageX, pageY),
- IntPoint(0, 0),
- ctrlKey, altKey, shiftKey, metaKey)
- , m_touches(touches)
- , m_targetTouches(targetTouches)
- , m_changedTouches(changedTouches)
-{
- ScriptWrappable::init(this);
-}
-
-TouchEvent::~TouchEvent()
-{
-}
-
-void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches,
- TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
-{
- if (dispatched())
- return;
-
- initUIEvent(type, true, true, view, 0);
-
- m_touches = touches;
- m_targetTouches = targetTouches;
- m_changedTouches = changedTouches;
- m_screenLocation = IntPoint(screenX, screenY);
- m_ctrlKey = ctrlKey;
- m_altKey = altKey;
- m_shiftKey = shiftKey;
- m_metaKey = metaKey;
- initCoordinates(IntPoint(clientX, clientY));
-}
-
-const AtomicString& TouchEvent::interfaceName() const
-{
- return eventNames().interfaceForTouchEvent;
-}
-
-bool TouchEvent::isTouchEvent() const
-{
- return true;
-}
-
-PassRefPtr<TouchEventDispatchMediator> TouchEventDispatchMediator::create(PassRefPtr<TouchEvent> touchEvent)
-{
- return adoptRef(new TouchEventDispatchMediator(touchEvent));
-}
-
-TouchEventDispatchMediator::TouchEventDispatchMediator(PassRefPtr<TouchEvent> touchEvent)
- : EventDispatchMediator(touchEvent)
-{
-}
-
-TouchEvent* TouchEventDispatchMediator::event() const
-{
- return static_cast<TouchEvent*>(EventDispatchMediator::event());
-}
-
-bool TouchEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
- EventRetargeter::adjustForTouchEvent(dispatcher->node(), *event());
- return dispatcher->dispatch();
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/TouchEvent.h b/Source/core/dom/TouchEvent.h
deleted file mode 100644
index 45a38dd..0000000
--- a/Source/core/dom/TouchEvent.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- * Copyright (C) 2012 Research In Motion Limited. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 TouchEvent_h
-#define TouchEvent_h
-
-#include "core/dom/EventDispatchMediator.h"
-#include "core/dom/MouseRelatedEvent.h"
-#include "core/dom/TouchList.h"
-
-namespace WebCore {
-
-class TouchEvent : public MouseRelatedEvent {
-public:
- virtual ~TouchEvent();
-
- static PassRefPtr<TouchEvent> create()
- {
- return adoptRef(new TouchEvent);
- }
- static PassRefPtr<TouchEvent> create(TouchList* touches,
- TouchList* targetTouches, TouchList* changedTouches,
- const AtomicString& type, PassRefPtr<AbstractView> view,
- int screenX, int screenY, int pageX, int pageY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
- {
- return adoptRef(new TouchEvent(touches, targetTouches, changedTouches,
- type, view, screenX, screenY, pageX, pageY,
- ctrlKey, altKey, shiftKey, metaKey));
- }
-
- void initTouchEvent(TouchList* touches, TouchList* targetTouches,
- TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView> view, int screenX, int screenY,
- int clientX, int clientY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
-
- TouchList* touches() const { return m_touches.get(); }
- TouchList* targetTouches() const { return m_targetTouches.get(); }
- TouchList* changedTouches() const { return m_changedTouches.get(); }
-
- void setTouches(PassRefPtr<TouchList> touches) { m_touches = touches; }
- void setTargetTouches(PassRefPtr<TouchList> targetTouches) { m_targetTouches = targetTouches; }
- void setChangedTouches(PassRefPtr<TouchList> changedTouches) { m_changedTouches = changedTouches; }
-
- virtual bool isTouchEvent() const OVERRIDE;
-
- virtual const AtomicString& interfaceName() const;
-
-private:
- TouchEvent();
- TouchEvent(TouchList* touches, TouchList* targetTouches,
- TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView>, int screenX, int screenY, int pageX,
- int pageY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
-
- RefPtr<TouchList> m_touches;
- RefPtr<TouchList> m_targetTouches;
- RefPtr<TouchList> m_changedTouches;
-};
-
-class TouchEventDispatchMediator : public EventDispatchMediator {
-public:
- static PassRefPtr<TouchEventDispatchMediator> create(PassRefPtr<TouchEvent>);
-
-private:
- explicit TouchEventDispatchMediator(PassRefPtr<TouchEvent>);
- TouchEvent* event() const;
- virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
-};
-
-inline TouchEvent* toTouchEvent(Event* event)
-{
- ASSERT(event && event->isTouchEvent());
- return static_cast<TouchEvent*>(event);
-}
-
-} // namespace WebCore
-
-#endif // TouchEvent_h
diff --git a/Source/core/dom/TouchEvent.idl b/Source/core/dom/TouchEvent.idl
deleted file mode 100644
index f4b396e..0000000
--- a/Source/core/dom/TouchEvent.idl
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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.
- */
-interface TouchEvent : UIEvent {
- readonly attribute TouchList touches;
- readonly attribute TouchList targetTouches;
- readonly attribute TouchList changedTouches;
- readonly attribute boolean ctrlKey;
- readonly attribute boolean shiftKey;
- readonly attribute boolean altKey;
- readonly attribute boolean metaKey;
-
- void initTouchEvent([Default=Undefined] optional TouchList touches,
- [Default=Undefined] optional TouchList targetTouches,
- [Default=Undefined] optional TouchList changedTouches,
- [Default=Undefined] optional DOMString type,
- [Default=Undefined] optional Window view,
- [Default=Undefined] optional long screenX,
- [Default=Undefined] optional long screenY,
- [Default=Undefined] optional long clientX,
- [Default=Undefined] optional long clientY,
- [Default=Undefined] optional boolean ctrlKey,
- [Default=Undefined] optional boolean altKey,
- [Default=Undefined] optional boolean shiftKey,
- [Default=Undefined] optional boolean metaKey);
-};
diff --git a/Source/core/dom/TransitionEvent.cpp b/Source/core/dom/TransitionEvent.cpp
deleted file mode 100644
index 346a66f..0000000
--- a/Source/core/dom/TransitionEvent.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Intel Corporation. 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 "core/dom/TransitionEvent.h"
-
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-TransitionEventInit::TransitionEventInit()
- : elapsedTime(0)
-{
-}
-
-TransitionEvent::TransitionEvent()
- : m_elapsedTime(0)
-{
- ScriptWrappable::init(this);
-}
-
-TransitionEvent::TransitionEvent(const AtomicString& type, const String& propertyName, double elapsedTime, const String& pseudoElement)
- : Event(type, true, true)
- , m_propertyName(propertyName)
- , m_elapsedTime(elapsedTime)
- , m_pseudoElement(pseudoElement)
-{
- ScriptWrappable::init(this);
-}
-
-TransitionEvent::TransitionEvent(const AtomicString& type, const TransitionEventInit& initializer)
- : Event(type, initializer)
- , m_propertyName(initializer.propertyName)
- , m_elapsedTime(initializer.elapsedTime)
- , m_pseudoElement(initializer.pseudoElement)
-{
- ScriptWrappable::init(this);
-}
-
-TransitionEvent::~TransitionEvent()
-{
-}
-
-const String& TransitionEvent::propertyName() const
-{
- return m_propertyName;
-}
-
-double TransitionEvent::elapsedTime() const
-{
- return m_elapsedTime;
-}
-
-const String& TransitionEvent::pseudoElement() const
-{
- return m_pseudoElement;
-}
-
-const AtomicString& TransitionEvent::interfaceName() const
-{
- return eventNames().interfaceForTransitionEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/TransitionEvent.h b/Source/core/dom/TransitionEvent.h
deleted file mode 100644
index 9fe4ffb..0000000
--- a/Source/core/dom/TransitionEvent.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Intel Corporation. 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 TransitionEvent_h
-#define TransitionEvent_h
-
-#include "core/dom/Event.h"
-
-namespace WebCore {
-
-struct TransitionEventInit : public EventInit {
- TransitionEventInit();
-
- String propertyName;
- double elapsedTime;
- String pseudoElement;
-};
-
-class TransitionEvent : public Event {
-public:
- static PassRefPtr<TransitionEvent> create()
- {
- return adoptRef(new TransitionEvent);
- }
- static PassRefPtr<TransitionEvent> create(const AtomicString& type, const String& propertyName, double elapsedTime, const String& pseudoElement)
- {
- return adoptRef(new TransitionEvent(type, propertyName, elapsedTime, pseudoElement));
- }
- static PassRefPtr<TransitionEvent> create(const AtomicString& type, const TransitionEventInit& initializer)
- {
- return adoptRef(new TransitionEvent(type, initializer));
- }
-
- virtual ~TransitionEvent();
-
- const String& propertyName() const;
- double elapsedTime() const;
- const String& pseudoElement() const;
-
- virtual const AtomicString& interfaceName() const;
-
-private:
- TransitionEvent();
- TransitionEvent(const AtomicString& type, const String& propertyName, double elapsedTime, const String& pseudoElement);
- TransitionEvent(const AtomicString& type, const TransitionEventInit& initializer);
-
- String m_propertyName;
- double m_elapsedTime;
- String m_pseudoElement;
-};
-
-} // namespace WebCore
-
-#endif // TransitionEvent_h
-
diff --git a/Source/core/dom/TransitionEvent.idl b/Source/core/dom/TransitionEvent.idl
deleted file mode 100644
index b2bd8ed..0000000
--- a/Source/core/dom/TransitionEvent.idl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Intel Corporation. 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.
- */
-
-[
- ConstructorTemplate=Event
-] interface TransitionEvent : Event {
- [InitializedByEventConstructor] readonly attribute DOMString propertyName;
- [InitializedByEventConstructor] readonly attribute double elapsedTime;
- [InitializedByEventConstructor] readonly attribute DOMString pseudoElement;
-};
-
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index e20240f..086ecf7 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -32,7 +32,7 @@
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/dom/ElementTraversal.h"
-#include "core/dom/EventPathWalker.h"
+#include "core/events/EventPathWalker.h"
#include "core/dom/IdTargetObserverRegistry.h"
#include "core/dom/TreeScopeAdopter.h"
#include "core/dom/shadow/ElementShadow.h"
@@ -208,7 +208,7 @@
if (!m_imageMapsByName)
return 0;
size_t hashPos = url.find('#');
- String name = (hashPos == notFound ? url : url.substring(hashPos + 1)).impl();
+ String name = (hashPos == kNotFound ? url : url.substring(hashPos + 1)).impl();
if (rootNode()->document().isHTMLDocument())
return toHTMLMapElement(m_imageMapsByName->getElementByLowercasedMapName(AtomicString(name.lower()).impl(), this));
return toHTMLMapElement(m_imageMapsByName->getElementByMapName(AtomicString(name).impl(), this));
diff --git a/Source/core/dom/UIEvent.cpp b/Source/core/dom/UIEvent.cpp
deleted file mode 100644
index ade3856..0000000
--- a/Source/core/dom/UIEvent.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/UIEvent.h"
-
-#include "core/page/DOMWindow.h"
-
-namespace WebCore {
-
-UIEventInit::UIEventInit()
- : view(0)
- , detail(0)
-{
-}
-
-UIEvent::UIEvent()
- : m_detail(0)
-{
- ScriptWrappable::init(this);
-}
-
-UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, PassRefPtr<AbstractView> viewArg, int detailArg)
- : Event(eventType, canBubbleArg, cancelableArg)
- , m_view(viewArg)
- , m_detail(detailArg)
-{
- ScriptWrappable::init(this);
-}
-
-UIEvent::UIEvent(const AtomicString& eventType, const UIEventInit& initializer)
- : Event(eventType, initializer)
- , m_view(initializer.view)
- , m_detail(initializer.detail)
-{
- ScriptWrappable::init(this);
-}
-
-UIEvent::~UIEvent()
-{
-}
-
-void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, PassRefPtr<AbstractView> viewArg, int detailArg)
-{
- if (dispatched())
- return;
-
- initEvent(typeArg, canBubbleArg, cancelableArg);
-
- m_view = viewArg;
- m_detail = detailArg;
-}
-
-bool UIEvent::isUIEvent() const
-{
- return true;
-}
-
-const AtomicString& UIEvent::interfaceName() const
-{
- return eventNames().interfaceForUIEvent;
-}
-
-int UIEvent::keyCode() const
-{
- return 0;
-}
-
-int UIEvent::charCode() const
-{
- return 0;
-}
-
-int UIEvent::layerX()
-{
- return 0;
-}
-
-int UIEvent::layerY()
-{
- return 0;
-}
-
-int UIEvent::pageX() const
-{
- return 0;
-}
-
-int UIEvent::pageY() const
-{
- return 0;
-}
-
-int UIEvent::which() const
-{
- return 0;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/UIEvent.h b/Source/core/dom/UIEvent.h
deleted file mode 100644
index ae52a89..0000000
--- a/Source/core/dom/UIEvent.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef UIEvent_h
-#define UIEvent_h
-
-#include "core/dom/Event.h"
-#include "core/dom/EventDispatchMediator.h"
-#include "core/page/DOMWindow.h"
-
-namespace WebCore {
-
-typedef DOMWindow AbstractView;
-
-struct UIEventInit : public EventInit {
- UIEventInit();
-
- RefPtr<AbstractView> view;
- int detail;
-};
-
-class UIEvent : public Event {
-public:
- static PassRefPtr<UIEvent> create()
- {
- return adoptRef(new UIEvent);
- }
- static PassRefPtr<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, int detail)
- {
- return adoptRef(new UIEvent(type, canBubble, cancelable, view, detail));
- }
- static PassRefPtr<UIEvent> create(const AtomicString& type, const UIEventInit& initializer)
- {
- return adoptRef(new UIEvent(type, initializer));
- }
- virtual ~UIEvent();
-
- void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int detail);
-
- AbstractView* view() const { return m_view.get(); }
- int detail() const { return m_detail; }
-
- virtual const AtomicString& interfaceName() const;
- virtual bool isUIEvent() const;
-
- virtual int keyCode() const;
- virtual int charCode() const;
-
- virtual int layerX();
- virtual int layerY();
-
- virtual int pageX() const;
- virtual int pageY() const;
-
- virtual int which() const;
-
-protected:
- UIEvent();
- UIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int detail);
- UIEvent(const AtomicString&, const UIEventInit&);
-
-private:
- RefPtr<AbstractView> m_view;
- int m_detail;
-};
-
-} // namespace WebCore
-
-#endif // UIEvent_h
diff --git a/Source/core/dom/UIEvent.idl b/Source/core/dom/UIEvent.idl
deleted file mode 100644
index bfa6da9..0000000
--- a/Source/core/dom/UIEvent.idl
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-[
- ConstructorTemplate=Event
-] interface UIEvent : Event {
- [InitializedByEventConstructor] readonly attribute Window view;
- [InitializedByEventConstructor] readonly attribute long detail;
-
- void initUIEvent([Default=Undefined] optional DOMString type,
- [Default=Undefined] optional boolean canBubble,
- [Default=Undefined] optional boolean cancelable,
- [Default=Undefined] optional Window view,
- [Default=Undefined] optional long detail);
-
- // extensions
- readonly attribute long keyCode;
- readonly attribute long charCode;
- readonly attribute long layerX;
- readonly attribute long layerY;
- readonly attribute long pageX;
- readonly attribute long pageY;
- readonly attribute long which;
-};
-
diff --git a/Source/core/dom/UIEventWithKeyState.cpp b/Source/core/dom/UIEventWithKeyState.cpp
deleted file mode 100644
index da510d9..0000000
--- a/Source/core/dom/UIEventWithKeyState.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "core/dom/UIEventWithKeyState.h"
-
-namespace WebCore {
-
-UIEventWithKeyState* findEventWithKeyState(Event* event)
-{
- for (Event* e = event; e; e = e->underlyingEvent())
- if (e->isKeyboardEvent() || e->isMouseEvent())
- return static_cast<UIEventWithKeyState*>(e);
- return 0;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/UIEventWithKeyState.h b/Source/core/dom/UIEventWithKeyState.h
deleted file mode 100644
index bcf9a80..0000000
--- a/Source/core/dom/UIEventWithKeyState.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef UIEventWithKeyState_h
-#define UIEventWithKeyState_h
-
-#include "core/dom/UIEvent.h"
-
-namespace WebCore {
-
- class UIEventWithKeyState : public UIEvent {
- public:
- bool ctrlKey() const { return m_ctrlKey; }
- bool shiftKey() const { return m_shiftKey; }
- bool altKey() const { return m_altKey; }
- bool metaKey() const { return m_metaKey; }
-
- protected:
- UIEventWithKeyState()
- : m_ctrlKey(false)
- , m_altKey(false)
- , m_shiftKey(false)
- , m_metaKey(false)
- {
- }
-
- UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
- int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
- : UIEvent(type, canBubble, cancelable, view, detail)
- , m_ctrlKey(ctrlKey)
- , m_altKey(altKey)
- , m_shiftKey(shiftKey)
- , m_metaKey(metaKey)
- {
- }
-
- // Expose these so init functions can set them.
- bool m_ctrlKey : 1;
- bool m_altKey : 1;
- bool m_shiftKey : 1;
- bool m_metaKey : 1;
- };
-
- UIEventWithKeyState* findEventWithKeyState(Event*);
-
-} // namespace WebCore
-
-#endif // UIEventWithKeyState_h
diff --git a/Source/core/dom/ViewportArguments.cpp b/Source/core/dom/ViewportArguments.cpp
index 48d56e4..0808c89 100644
--- a/Source/core/dom/ViewportArguments.cpp
+++ b/Source/core/dom/ViewportArguments.cpp
@@ -235,7 +235,7 @@
if (value < 0)
return Length(); // auto
- if (!static_cast<int>(value) && document->page() && document->page()->settings().viewportMetaZeroValuesQuirk()) {
+ if (!value && document->page() && document->page()->settings().viewportMetaZeroValuesQuirk()) {
if (keyString == "width")
return Length(100, ViewportPercentageWidth);
if (keyString == "height")
@@ -270,7 +270,7 @@
if (value > 10.0)
reportViewportWarning(document, MaximumScaleTooLargeError, String(), String());
- if (!static_cast<int>(value) && document->page() && document->page()->settings().viewportMetaZeroValuesQuirk() && (keyString == "minimum-scale" || keyString == "maximum-scale"))
+ if (!value && document->page() && document->page()->settings().viewportMetaZeroValuesQuirk() && (keyString == "minimum-scale" || keyString == "maximum-scale"))
return ViewportArguments::ValueAuto;
return clampScaleValue(value);
diff --git a/Source/core/dom/WebKitAnimationEvent.cpp b/Source/core/dom/WebKitAnimationEvent.cpp
deleted file mode 100644
index 777a5a4..0000000
--- a/Source/core/dom/WebKitAnimationEvent.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 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 "core/dom/WebKitAnimationEvent.h"
-
-#include "core/dom/EventNames.h"
-
-namespace WebCore {
-
-WebKitAnimationEventInit::WebKitAnimationEventInit()
- : animationName()
- , elapsedTime(0.0)
-{
-}
-
-WebKitAnimationEvent::WebKitAnimationEvent()
- : m_elapsedTime(0.0)
-{
- ScriptWrappable::init(this);
-}
-
-WebKitAnimationEvent::WebKitAnimationEvent(const AtomicString& type, const WebKitAnimationEventInit& initializer)
- : Event(type, initializer)
- , m_animationName(initializer.animationName)
- , m_elapsedTime(initializer.elapsedTime)
-{
- ScriptWrappable::init(this);
-}
-
-WebKitAnimationEvent::WebKitAnimationEvent(const AtomicString& type, const String& animationName, double elapsedTime)
- : Event(type, true, true)
- , m_animationName(animationName)
- , m_elapsedTime(elapsedTime)
-{
- ScriptWrappable::init(this);
-}
-
-WebKitAnimationEvent::~WebKitAnimationEvent()
-{
-}
-
-const String& WebKitAnimationEvent::animationName() const
-{
- return m_animationName;
-}
-
-double WebKitAnimationEvent::elapsedTime() const
-{
- return m_elapsedTime;
-}
-
-const AtomicString& WebKitAnimationEvent::interfaceName() const
-{
- return eventNames().interfaceForWebKitAnimationEvent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/WebKitAnimationEvent.h b/Source/core/dom/WebKitAnimationEvent.h
deleted file mode 100644
index 8f642bf..0000000
--- a/Source/core/dom/WebKitAnimationEvent.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 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 WebKitAnimationEvent_h
-#define WebKitAnimationEvent_h
-
-#include "core/dom/Event.h"
-
-namespace WebCore {
-
-// FIXME : This class has a WebKit prefix on purpose so we can use the EventAliases system. When the
-// runtime flag of unprefixed animation will be removed we can rename that class and do the same as
-// the CSS Transitions.
-struct WebKitAnimationEventInit : public EventInit {
- WebKitAnimationEventInit();
-
- String animationName;
- double elapsedTime;
-};
-
-class WebKitAnimationEvent : public Event {
-public:
- static PassRefPtr<WebKitAnimationEvent> create()
- {
- return adoptRef(new WebKitAnimationEvent);
- }
- static PassRefPtr<WebKitAnimationEvent> create(const AtomicString& type, const String& animationName, double elapsedTime)
- {
- return adoptRef(new WebKitAnimationEvent(type, animationName, elapsedTime));
- }
- static PassRefPtr<WebKitAnimationEvent> create(const AtomicString& type, const WebKitAnimationEventInit& initializer)
- {
- return adoptRef(new WebKitAnimationEvent(type, initializer));
- }
-
- virtual ~WebKitAnimationEvent();
-
- const String& animationName() const;
- double elapsedTime() const;
-
- virtual const AtomicString& interfaceName() const;
-
-private:
- WebKitAnimationEvent();
- WebKitAnimationEvent(const AtomicString& type, const String& animationName, double elapsedTime);
- WebKitAnimationEvent(const AtomicString&, const WebKitAnimationEventInit&);
-
- String m_animationName;
- double m_elapsedTime;
-};
-
-} // namespace WebCore
-
-#endif // WebKitAnimationEvent_h
diff --git a/Source/core/dom/WebKitAnimationEvent.idl b/Source/core/dom/WebKitAnimationEvent.idl
deleted file mode 100644
index a168306..0000000
--- a/Source/core/dom/WebKitAnimationEvent.idl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 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.
- */
-
-[
- ConstructorTemplate=Event
-] interface WebKitAnimationEvent : Event {
- [InitializedByEventConstructor] readonly attribute DOMString animationName;
- [InitializedByEventConstructor] readonly attribute double elapsedTime;
-};
-
diff --git a/Source/core/dom/WheelController.cpp b/Source/core/dom/WheelController.cpp
index 48c14a7..b55b9c9 100644
--- a/Source/core/dom/WheelController.cpp
+++ b/Source/core/dom/WheelController.cpp
@@ -27,8 +27,8 @@
#include "core/dom/WheelController.h"
#include "core/dom/Document.h"
-#include "core/dom/EventNames.h"
-#include "core/dom/WheelEvent.h"
+#include "core/events/EventNames.h"
+#include "core/events/WheelEvent.h"
#include "core/page/Frame.h"
#include "core/page/Page.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
diff --git a/Source/core/dom/WheelController.h b/Source/core/dom/WheelController.h
index 13406ee..71ad326 100644
--- a/Source/core/dom/WheelController.h
+++ b/Source/core/dom/WheelController.h
@@ -26,7 +26,7 @@
#ifndef WheelController_h
#define WheelController_h
-#include "core/dom/Event.h"
+#include "core/events/Event.h"
#include "core/page/DOMWindowLifecycleObserver.h"
#include "core/platform/Supplementable.h"
diff --git a/Source/core/dom/WheelEvent.cpp b/Source/core/dom/WheelEvent.cpp
deleted file mode 100644
index f2b71f6..0000000
--- a/Source/core/dom/WheelEvent.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Samsung Electronics. 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/WheelEvent.h"
-
-#include "core/dom/Clipboard.h"
-#include "core/dom/EventNames.h"
-#include "core/platform/PlatformWheelEvent.h"
-
-namespace WebCore {
-
-WheelEventInit::WheelEventInit()
- : deltaX(0)
- , deltaY(0)
- , deltaZ(0)
- , wheelDeltaX(0)
- , wheelDeltaY(0)
- , deltaMode(WheelEvent::DOM_DELTA_PIXEL)
-{
-}
-
-WheelEvent::WheelEvent()
- : m_deltaX(0)
- , m_deltaY(0)
- , m_deltaZ(0)
- , m_deltaMode(DOM_DELTA_PIXEL)
- , m_directionInvertedFromDevice(false)
-{
- ScriptWrappable::init(this);
-}
-
-WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializer)
- : MouseEvent(type, initializer)
- , m_wheelDelta(initializer.wheelDeltaX ? initializer.wheelDeltaX : -initializer.deltaX, initializer.wheelDeltaY ? initializer.wheelDeltaY : -initializer.deltaY)
- , m_deltaX(initializer.deltaX ? initializer.deltaX : -initializer.wheelDeltaX)
- , m_deltaY(initializer.deltaY ? initializer.deltaY : -initializer.wheelDeltaY)
- , m_deltaZ(initializer.deltaZ)
- , m_deltaMode(initializer.deltaMode)
-{
- ScriptWrappable::init(this);
-}
-
-WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, unsigned deltaMode,
- PassRefPtr<AbstractView> view, const IntPoint& screenLocation, const IntPoint& pageLocation,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice)
- : MouseEvent(eventNames().wheelEvent,
- true, true, view, 0, screenLocation.x(), screenLocation.y(),
- pageLocation.x(), pageLocation.y(),
- 0, 0,
- ctrlKey, altKey, shiftKey, metaKey, 0, 0, 0, false)
- , m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultiplier)
- , m_deltaX(-rawDelta.x())
- , m_deltaY(-rawDelta.y())
- , m_deltaZ(0)
- , m_deltaMode(deltaMode)
- , m_directionInvertedFromDevice(directionInvertedFromDevice)
-{
- ScriptWrappable::init(this);
-}
-
-void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView> view,
- int screenX, int screenY, int pageX, int pageY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
-{
- if (dispatched())
- return;
-
- initUIEvent(eventNames().wheelEvent, true, true, view, 0);
-
- m_screenLocation = IntPoint(screenX, screenY);
- m_ctrlKey = ctrlKey;
- m_altKey = altKey;
- m_shiftKey = shiftKey;
- m_metaKey = metaKey;
-
- m_wheelDelta = IntPoint(rawDeltaX * TickMultiplier, rawDeltaY * TickMultiplier);
- m_deltaX = -rawDeltaX;
- m_deltaY = -rawDeltaY;
- m_deltaMode = DOM_DELTA_PIXEL;
- m_directionInvertedFromDevice = false;
-
- initCoordinates(IntPoint(pageX, pageY));
-}
-
-void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView> view,
- int screenX, int screenY, int pageX, int pageY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
-{
- initWheelEvent(rawDeltaX, rawDeltaY, view, screenX, screenY, pageX, pageY,
- ctrlKey, altKey, shiftKey, metaKey);
-}
-
-const AtomicString& WheelEvent::interfaceName() const
-{
- return eventNames().interfaceForWheelEvent;
-}
-
-bool WheelEvent::isMouseEvent() const
-{
- return false;
-}
-
-inline static unsigned deltaMode(const PlatformWheelEvent& event)
-{
- return event.granularity() == ScrollByPageWheelEvent ? WheelEvent::DOM_DELTA_PAGE : WheelEvent::DOM_DELTA_PIXEL;
-}
-
-PassRefPtr<WheelEventDispatchMediator> WheelEventDispatchMediator::create(const PlatformWheelEvent& event, PassRefPtr<AbstractView> view)
-{
- return adoptRef(new WheelEventDispatchMediator(event, view));
-}
-
-WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent& event, PassRefPtr<AbstractView> view)
-{
- if (!(event.deltaX() || event.deltaY()))
- return;
-
- setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicksY()), FloatPoint(event.deltaX(), event.deltaY()),
- deltaMode(event), view, event.globalPosition(), event.position(),
- event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.directionInvertedFromDevice()));
-}
-
-WheelEvent* WheelEventDispatchMediator::event() const
-{
- return static_cast<WheelEvent*>(EventDispatchMediator::event());
-}
-
-bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
-{
- ASSERT(event());
- return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->defaultHandled();
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/WheelEvent.h b/Source/core/dom/WheelEvent.h
deleted file mode 100644
index c393f37..0000000
--- a/Source/core/dom/WheelEvent.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
- * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Samsung Electronics. 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef WheelEvent_h
-#define WheelEvent_h
-
-#include "core/dom/EventDispatchMediator.h"
-#include "core/dom/MouseEvent.h"
-#include "core/platform/graphics/FloatPoint.h"
-
-namespace WebCore {
-
-class PlatformWheelEvent;
-
-struct WheelEventInit : public MouseEventInit {
- WheelEventInit();
-
- double deltaX;
- double deltaY;
- double deltaZ;
- int wheelDeltaX; // Deprecated.
- int wheelDeltaY; // Deprecated.
- unsigned deltaMode;
-};
-
-class WheelEvent : public MouseEvent {
-public:
- enum { TickMultiplier = 120 };
-
- enum DeltaMode {
- DOM_DELTA_PIXEL = 0,
- DOM_DELTA_LINE,
- DOM_DELTA_PAGE
- };
-
- static PassRefPtr<WheelEvent> create()
- {
- return adoptRef(new WheelEvent);
- }
-
- static PassRefPtr<WheelEvent> create(const AtomicString& type, const WheelEventInit& initializer)
- {
- return adoptRef(new WheelEvent(type, initializer));
- }
-
- static PassRefPtr<WheelEvent> create(const FloatPoint& wheelTicks,
- const FloatPoint& rawDelta, unsigned deltaMode, PassRefPtr<AbstractView> view,
- const IntPoint& screenLocation, const IntPoint& pageLocation,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice)
- {
- return adoptRef(new WheelEvent(wheelTicks, rawDelta, deltaMode, view,
- screenLocation, pageLocation, ctrlKey, altKey, shiftKey, metaKey, directionInvertedFromDevice));
- }
-
- void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
- int screenX, int screenY, int pageX, int pageY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
-
- void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
- int screenX, int screenY, int pageX, int pageY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
-
- double deltaX() const { return m_deltaX; } // Positive when scrolling right.
- double deltaY() const { return m_deltaY; } // Positive when scrolling down.
- double deltaZ() const { return m_deltaZ; }
- int wheelDelta() const { return wheelDeltaY() ? wheelDeltaY() : wheelDeltaX(); } // Deprecated.
- int wheelDeltaX() const { return m_wheelDelta.x(); } // Deprecated, negative when scrolling right.
- int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative when scrolling down.
- unsigned deltaMode() const { return m_deltaMode; }
- float ticksX() const { return static_cast<float>(m_wheelDelta.x()) / TickMultiplier; }
- float ticksY() const { return static_cast<float>(m_wheelDelta.y()) / TickMultiplier; }
-
- bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedFromDevice; }
-
- virtual const AtomicString& interfaceName() const;
- virtual bool isMouseEvent() const;
-
-private:
- WheelEvent();
- WheelEvent(const AtomicString&, const WheelEventInit&);
- WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
- unsigned, PassRefPtr<AbstractView>, const IntPoint& screenLocation, const IntPoint& pageLocation,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice);
-
- IntPoint m_wheelDelta;
- double m_deltaX;
- double m_deltaY;
- double m_deltaZ;
- unsigned m_deltaMode;
- bool m_directionInvertedFromDevice;
-};
-
-class WheelEventDispatchMediator : public EventDispatchMediator {
-public:
- static PassRefPtr<WheelEventDispatchMediator> create(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
-private:
- WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
- WheelEvent* event() const;
- virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
-};
-
-} // namespace WebCore
-
-#endif // WheelEvent_h
diff --git a/Source/core/dom/WheelEvent.idl b/Source/core/dom/WheelEvent.idl
deleted file mode 100644
index 8ee63ae..0000000
--- a/Source/core/dom/WheelEvent.idl
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2013 Samsung Electronics. 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-// Introduced in DOM Level 3:
-[
- ConstructorTemplate=Event
-] interface WheelEvent : MouseEvent {
- // DeltaModeCode
- const unsigned long DOM_DELTA_PIXEL = 0x00;
- const unsigned long DOM_DELTA_LINE = 0x01;
- const unsigned long DOM_DELTA_PAGE = 0x02;
-
- [InitializedByEventConstructor] readonly attribute double deltaX;
- [InitializedByEventConstructor] readonly attribute double deltaY;
- [InitializedByEventConstructor] readonly attribute double deltaZ;
- [InitializedByEventConstructor] readonly attribute unsigned long deltaMode;
-
- // Non standard API.
- [InitializedByEventConstructor] readonly attribute long wheelDeltaX;
- [InitializedByEventConstructor] readonly attribute long wheelDeltaY;
- readonly attribute long wheelDelta;
-
- // WebKit Extension
- readonly attribute boolean webkitDirectionInvertedFromDevice;
-
- void initWebKitWheelEvent([Default=Undefined] optional long wheelDeltaX,
- [Default=Undefined] optional long wheelDeltaY,
- [Default=Undefined] optional Window view,
- [Default=Undefined] optional long screenX,
- [Default=Undefined] optional long screenY,
- [Default=Undefined] optional long clientX,
- [Default=Undefined] optional long clientY,
- [Default=Undefined] optional boolean ctrlKey,
- [Default=Undefined] optional boolean altKey,
- [Default=Undefined] optional boolean shiftKey,
- [Default=Undefined] optional boolean metaKey);
-};
diff --git a/Source/core/dom/WindowEventContext.cpp b/Source/core/dom/WindowEventContext.cpp
deleted file mode 100644
index b9cbaa9..0000000
--- a/Source/core/dom/WindowEventContext.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 "core/dom/WindowEventContext.h"
-
-#include "core/dom/Document.h"
-#include "core/dom/Event.h"
-#include "core/dom/EventContext.h"
-#include "core/dom/Node.h"
-#include "core/page/DOMWindow.h"
-
-namespace WebCore {
-
-WindowEventContext::WindowEventContext(Event* event, PassRefPtr<Node> node, const EventContext* topEventContext)
-{
- // We don't dispatch load events to the window. This quirk was originally
- // added because Mozilla doesn't propagate load events to the window object.
- if (event->type() == eventNames().loadEvent)
- return;
-
- Node* topLevelContainer = topEventContext ? topEventContext->node() : node.get();
- if (!topLevelContainer->isDocumentNode())
- return;
-
- m_window = toDocument(topLevelContainer)->domWindow();
- m_target = topEventContext ? topEventContext->target() : node.get();
-}
-
-bool WindowEventContext::handleLocalEvents(Event* event)
-{
- if (!m_window)
- return false;
-
- event->setTarget(target());
- event->setCurrentTarget(window());
- m_window->fireEventListeners(event);
- return true;
-}
-
-}
diff --git a/Source/core/dom/WindowEventContext.h b/Source/core/dom/WindowEventContext.h
deleted file mode 100644
index 25c5079..0000000
--- a/Source/core/dom/WindowEventContext.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 WindowEventContext_h
-#define WindowEventContext_h
-
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class DOMWindow;
-class EventTarget;
-class EventContext;
-class Event;
-class Node;
-
-class WindowEventContext {
-public:
- WindowEventContext(Event*, PassRefPtr<Node>, const EventContext*);
-
- DOMWindow* window() const;
- EventTarget* target() const;
- bool handleLocalEvents(Event* event);
-
-private:
- RefPtr<DOMWindow> m_window;
- RefPtr<EventTarget> m_target;
-};
-
-inline DOMWindow* WindowEventContext::window() const
-{
- return m_window.get();
-}
-
-inline EventTarget* WindowEventContext::target() const
-{
- return m_target.get();
-}
-
-}
-
-#endif // WindowEventContext_h
diff --git a/Source/core/dom/default/PlatformMessagePortChannel.cpp b/Source/core/dom/default/PlatformMessagePortChannel.cpp
deleted file mode 100644
index 2837517..0000000
--- a/Source/core/dom/default/PlatformMessagePortChannel.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2013 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:
- *
- * * 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 "core/dom/default/PlatformMessagePortChannel.h"
-
-#include "core/dom/MessagePort.h"
-#include "core/dom/ScriptExecutionContext.h"
-
-namespace WebCore {
-
-PassOwnPtr<PlatformMessagePortChannel::EventData> PlatformMessagePortChannel::EventData::create(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
-{
- return adoptPtr(new EventData(message, channels));
-}
-
-PlatformMessagePortChannel::EventData::EventData(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
- : m_message(message)
- , m_channels(channels)
-{
-}
-
-void MessagePortChannel::createChannel(PassRefPtr<MessagePort> port1, PassRefPtr<MessagePort> port2)
-{
- RefPtr<PlatformMessagePortChannel::MessagePortQueue> queue1 = PlatformMessagePortChannel::MessagePortQueue::create();
- RefPtr<PlatformMessagePortChannel::MessagePortQueue> queue2 = PlatformMessagePortChannel::MessagePortQueue::create();
-
- OwnPtr<MessagePortChannel> channel1 = adoptPtr(new MessagePortChannel(PlatformMessagePortChannel::create(queue1, queue2)));
- OwnPtr<MessagePortChannel> channel2 = adoptPtr(new MessagePortChannel(PlatformMessagePortChannel::create(queue2, queue1)));
-
- channel1->m_channel->m_entangledChannel = channel2->m_channel;
- channel2->m_channel->m_entangledChannel = channel1->m_channel;
-
- port1->entangle(channel2.release());
- port2->entangle(channel1.release());
-}
-
-MessagePortChannel::MessagePortChannel(PassRefPtr<PlatformMessagePortChannel> channel)
- : m_channel(channel)
-{
-}
-
-MessagePortChannel::~MessagePortChannel()
-{
- close();
-}
-
-bool MessagePortChannel::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 = m_channel->entangledChannel();
- if (!remote)
- return false;
- remote->setRemotePort(port);
- return true;
-}
-
-void MessagePortChannel::disentangle()
-{
- RefPtr<PlatformMessagePortChannel> remote = m_channel->entangledChannel();
- if (remote)
- remote->setRemotePort(0);
-}
-
-void MessagePortChannel::postMessageToRemote(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
-{
- MutexLocker lock(m_channel->m_mutex);
- if (!m_channel->m_outgoingQueue)
- return;
- bool wasEmpty = m_channel->m_outgoingQueue->appendAndCheckEmpty(PlatformMessagePortChannel::EventData::create(message, channels));
- if (wasEmpty && m_channel->m_remotePort)
- m_channel->m_remotePort->messageAvailable();
-}
-
-bool MessagePortChannel::tryGetMessageFromRemote(RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePortChannelArray>& channels)
-{
- MutexLocker lock(m_channel->m_mutex);
- OwnPtr<PlatformMessagePortChannel::EventData> result = m_channel->m_incomingQueue->tryGetMessage();
- if (!result)
- return false;
-
- message = result->message();
- channels = result->channels();
-
- return true;
-}
-
-void MessagePortChannel::close()
-{
- RefPtr<PlatformMessagePortChannel> remote = m_channel->entangledChannel();
- if (!remote)
- return;
- m_channel->closeInternal();
- remote->closeInternal();
-}
-
-bool MessagePortChannel::isConnectedTo(MessagePort* port)
-{
- // FIXME: What guarantees that the result remains the same after we release the lock?
- MutexLocker lock(m_channel->m_mutex);
- return m_channel->m_remotePort == port;
-}
-
-bool MessagePortChannel::hasPendingActivity()
-{
- // FIXME: What guarantees that the result remains the same after we release the lock?
- MutexLocker lock(m_channel->m_mutex);
- return !m_channel->m_incomingQueue->isEmpty();
-}
-
-MessagePort* MessagePortChannel::locallyEntangledPort(const ScriptExecutionContext* context)
-{
- MutexLocker lock(m_channel->m_mutex);
- // See if both contexts are run by the same thread (are the same context, or are both documents).
- if (m_channel->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_channel->m_remotePort->scriptExecutionContext();
- if (remoteContext == context || (remoteContext && remoteContext->isDocument() && context->isDocument()))
- return m_channel->m_remotePort;
- }
- return 0;
-}
-
-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_incomingQueue(incoming)
- , m_outgoingQueue(outgoing)
- , m_remotePort(0)
-{
-}
-
-PlatformMessagePortChannel::~PlatformMessagePortChannel()
-{
-}
-
-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;
-}
-
-PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::entangledChannel()
-{
- // FIXME: What guarantees that the result remains the same after we release the lock?
- // This lock only guarantees that the returned pointer will not be pointing to released memory,
- // but not that it will still be pointing to this object's entangled port channel.
- MutexLocker lock(m_mutex);
- return m_entangledChannel;
-}
-
-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;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/default/PlatformMessagePortChannel.h b/Source/core/dom/default/PlatformMessagePortChannel.h
deleted file mode 100644
index f8dffd0..0000000
--- a/Source/core/dom/default/PlatformMessagePortChannel.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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 "core/dom/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 ThreadSafeRefCounted<PlatformMessagePortChannel> {
- public:
- class EventData {
- WTF_MAKE_NONCOPYABLE(EventData); WTF_MAKE_FAST_ALLOCATED;
- public:
- static PassOwnPtr<EventData> create(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>);
-
- PassRefPtr<SerializedScriptValue> message() { return m_message; }
- PassOwnPtr<MessagePortChannelArray> channels() { return m_channels.release(); }
-
- private:
- EventData(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray>);
- RefPtr<SerializedScriptValue> m_message;
- OwnPtr<MessagePortChannelArray> m_channels;
- };
-
- // Wrapper for MessageQueue that allows us to do thread safe sharing by two proxies.
- class MessagePortQueue : public ThreadSafeRefCounted<MessagePortQueue> {
- public:
- static PassRefPtr<MessagePortQueue> create() { return adoptRef(new MessagePortQueue()); }
-
- PassOwnPtr<PlatformMessagePortChannel::EventData> tryGetMessage()
- {
- return m_queue.tryGetMessage();
- }
-
- bool appendAndCheckEmpty(PassOwnPtr<PlatformMessagePortChannel::EventData> message)
- {
- return m_queue.appendAndCheckEmpty(message);
- }
-
- bool isEmpty()
- {
- return m_queue.isEmpty();
- }
-
- private:
- MessagePortQueue() { }
-
- MessageQueue<PlatformMessagePortChannel::EventData> m_queue;
- };
-
- ~PlatformMessagePortChannel();
-
- static PassRefPtr<PlatformMessagePortChannel> create(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing);
- PlatformMessagePortChannel(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing);
-
- PassRefPtr<PlatformMessagePortChannel> entangledChannel();
-
- void setRemotePort(MessagePort*);
- 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
diff --git a/Source/core/dom/shadow/ContentDistribution.cpp b/Source/core/dom/shadow/ContentDistribution.cpp
index 8333841..e0527ad 100644
--- a/Source/core/dom/shadow/ContentDistribution.cpp
+++ b/Source/core/dom/shadow/ContentDistribution.cpp
@@ -49,7 +49,7 @@
{
HashMap<const Node*, size_t>::const_iterator it = m_indices.find(node);
if (it == m_indices.end())
- return notFound;
+ return kNotFound;
return it.get()->value;
}
@@ -57,7 +57,7 @@
Node* ContentDistribution::nextTo(const Node* node) const
{
size_t index = find(node);
- if (index == notFound || index + 1 == size())
+ if (index == kNotFound || index + 1 == size())
return 0;
return at(index + 1).get();
}
@@ -65,7 +65,7 @@
Node* ContentDistribution::previousTo(const Node* node) const
{
size_t index = find(node);
- if (index == notFound || !index)
+ if (index == kNotFound || !index)
return 0;
return at(index - 1).get();
}