[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:28:30 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit ba71b56778d44f73adca724fa85d7b495d584ad9
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 10 08:01:36 2009 +0000

    2009-11-09  Yaar Schnitman  <yaar at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            Up-streaming Chromium API src files: WebFileInputElement...WebNotifications
    
            https://bugs.webkit.org/show_bug.cgi?id=31276
    
            * src/WebInputElement.cpp: Added.
            (WebKit::WebInputElement::WebInputElement):
            (WebKit::WebInputElement::operator=):
            (WebKit::WebInputElement::operator WTF::PassRefPtr<HTMLInputElement>):
            (WebKit::WebInputElement::setActivatedSubmit):
            (WebKit::WebInputElement::setValue):
            (WebKit::WebInputElement::value):
            (WebKit::WebInputElement::setAutofilled):
            (WebKit::WebInputElement::dispatchFormControlChangeEvent):
            (WebKit::WebInputElement::setSelectionRange):
            * src/WebInputEvent.cpp: Added.
            (WebKit::staticKeyIdentifiers):
            (WebKit::WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode):
            * src/WebInputEventConversion.cpp: Added.
            (WebKit::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
            (WebKit::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
            (WebKit::toPlatformKeyboardEventType):
            (WebKit::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
            (WebKit::PlatformKeyboardEventBuilder::setKeyType):
            (WebKit::PlatformKeyboardEventBuilder::isCharacterKey):
            (WebKit::getWebInputModifiers):
            (WebKit::WebMouseEventBuilder::WebMouseEventBuilder):
            (WebKit::WebKeyboardEventBuilder::WebKeyboardEventBuilder):
            * src/WebInputEventConversion.h: Added.
            * src/WebKit.cpp: Added.
            (WebKit::initialize):
            (WebKit::shutdown):
            (WebKit::webKitClient):
            (WebKit::setLayoutTestMode):
            (WebKit::layoutTestMode):
            (WebKit::resetPluginCache):
            * src/WebMediaPlayerClientImpl.cpp: Added.
            (WebKit::createWebMediaPlayer):
            (WebKit::WebMediaPlayerClientImpl::isEnabled):
            (WebKit::WebMediaPlayerClientImpl::setIsEnabled):
            (WebKit::WebMediaPlayerClientImpl::registerSelf):
            (WebKit::WebMediaPlayerClientImpl::networkStateChanged):
            (WebKit::WebMediaPlayerClientImpl::readyStateChanged):
            (WebKit::WebMediaPlayerClientImpl::volumeChanged):
            (WebKit::WebMediaPlayerClientImpl::timeChanged):
            (WebKit::WebMediaPlayerClientImpl::repaint):
            (WebKit::WebMediaPlayerClientImpl::durationChanged):
            (WebKit::WebMediaPlayerClientImpl::rateChanged):
            (WebKit::WebMediaPlayerClientImpl::sizeChanged):
            (WebKit::WebMediaPlayerClientImpl::sawUnsupportedTracks):
            (WebKit::WebMediaPlayerClientImpl::load):
            (WebKit::WebMediaPlayerClientImpl::cancelLoad):
            (WebKit::WebMediaPlayerClientImpl::play):
            (WebKit::WebMediaPlayerClientImpl::pause):
            (WebKit::WebMediaPlayerClientImpl::naturalSize):
            (WebKit::WebMediaPlayerClientImpl::hasVideo):
            (WebKit::WebMediaPlayerClientImpl::hasAudio):
            (WebKit::WebMediaPlayerClientImpl::setVisible):
            (WebKit::WebMediaPlayerClientImpl::duration):
            (WebKit::WebMediaPlayerClientImpl::currentTime):
            (WebKit::WebMediaPlayerClientImpl::seek):
            (WebKit::WebMediaPlayerClientImpl::seeking):
            (WebKit::WebMediaPlayerClientImpl::setEndTime):
            (WebKit::WebMediaPlayerClientImpl::setRate):
            (WebKit::WebMediaPlayerClientImpl::paused):
            (WebKit::WebMediaPlayerClientImpl::supportsFullscreen):
            (WebKit::WebMediaPlayerClientImpl::supportsSave):
            (WebKit::WebMediaPlayerClientImpl::setVolume):
            (WebKit::WebMediaPlayerClientImpl::networkState):
            (WebKit::WebMediaPlayerClientImpl::readyState):
            (WebKit::WebMediaPlayerClientImpl::maxTimeSeekable):
            (WebKit::WebMediaPlayerClientImpl::buffered):
            (WebKit::WebMediaPlayerClientImpl::dataRate):
            (WebKit::WebMediaPlayerClientImpl::totalBytesKnown):
            (WebKit::WebMediaPlayerClientImpl::totalBytes):
            (WebKit::WebMediaPlayerClientImpl::bytesLoaded):
            (WebKit::WebMediaPlayerClientImpl::setSize):
            (WebKit::WebMediaPlayerClientImpl::paint):
            (WebKit::WebMediaPlayerClientImpl::setAutobuffer):
            (WebKit::WebMediaPlayerClientImpl::hasSingleSecurityOrigin):
            (WebKit::WebMediaPlayerClientImpl::movieLoadType):
            (WebKit::WebMediaPlayerClientImpl::create):
            (WebKit::WebMediaPlayerClientImpl::getSupportedTypes):
            (WebKit::WebMediaPlayerClientImpl::supportsType):
            (WebKit::WebMediaPlayerClientImpl::WebMediaPlayerClientImpl):
            * src/WebMediaPlayerClientImpl.h: Added.
            * src/WebNode.cpp: Added.
            (WebKit::WebNode::reset):
            (WebKit::WebNode::assign):
            (WebKit::WebNode::parentNode):
            (WebKit::WebNode::nodeName):
            (WebKit::WebNode::WebNode):
            (WebKit::WebNode::operator=):
            (WebKit::WebNode::operator WTF::PassRefPtr<WebCore::Node>):
            (WebKit::WebNode::frame):
            * src/WebNotification.cpp: Added.
            (WebKit::WebNotification::reset):
            (WebKit::WebNotification::assign):
            (WebKit::WebNotification::lessThan):
            (WebKit::WebNotification::isHTML):
            (WebKit::WebNotification::url):
            (WebKit::WebNotification::icon):
            (WebKit::WebNotification::title):
            (WebKit::WebNotification::body):
            (WebKit::WebNotification::dispatchDisplayEvent):
            (WebKit::WebNotification::dispatchErrorEvent):
            (WebKit::WebNotification::dispatchCloseEvent):
            (WebKit::WebNotification::WebNotification):
            (WebKit::WebNotification::operator=):
            (WebKit::WebNotification::operator WTF::PassRefPtr<Notification>):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50721 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 10952fc..5e4c81c 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -2,6 +2,120 @@
 
         Reviewed by Dimitri Glazkov.
 
+        Up-streaming Chromium API src files: WebFileInputElement...WebNotifications
+
+        https://bugs.webkit.org/show_bug.cgi?id=31276
+
+        * src/WebInputElement.cpp: Added.
+        (WebKit::WebInputElement::WebInputElement):
+        (WebKit::WebInputElement::operator=):
+        (WebKit::WebInputElement::operator WTF::PassRefPtr<HTMLInputElement>):
+        (WebKit::WebInputElement::setActivatedSubmit):
+        (WebKit::WebInputElement::setValue):
+        (WebKit::WebInputElement::value):
+        (WebKit::WebInputElement::setAutofilled):
+        (WebKit::WebInputElement::dispatchFormControlChangeEvent):
+        (WebKit::WebInputElement::setSelectionRange):
+        * src/WebInputEvent.cpp: Added.
+        (WebKit::staticKeyIdentifiers):
+        (WebKit::WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode):
+        * src/WebInputEventConversion.cpp: Added.
+        (WebKit::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
+        (WebKit::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
+        (WebKit::toPlatformKeyboardEventType):
+        (WebKit::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
+        (WebKit::PlatformKeyboardEventBuilder::setKeyType):
+        (WebKit::PlatformKeyboardEventBuilder::isCharacterKey):
+        (WebKit::getWebInputModifiers):
+        (WebKit::WebMouseEventBuilder::WebMouseEventBuilder):
+        (WebKit::WebKeyboardEventBuilder::WebKeyboardEventBuilder):
+        * src/WebInputEventConversion.h: Added.
+        * src/WebKit.cpp: Added.
+        (WebKit::initialize):
+        (WebKit::shutdown):
+        (WebKit::webKitClient):
+        (WebKit::setLayoutTestMode):
+        (WebKit::layoutTestMode):
+        (WebKit::resetPluginCache):
+        * src/WebMediaPlayerClientImpl.cpp: Added.
+        (WebKit::createWebMediaPlayer):
+        (WebKit::WebMediaPlayerClientImpl::isEnabled):
+        (WebKit::WebMediaPlayerClientImpl::setIsEnabled):
+        (WebKit::WebMediaPlayerClientImpl::registerSelf):
+        (WebKit::WebMediaPlayerClientImpl::networkStateChanged):
+        (WebKit::WebMediaPlayerClientImpl::readyStateChanged):
+        (WebKit::WebMediaPlayerClientImpl::volumeChanged):
+        (WebKit::WebMediaPlayerClientImpl::timeChanged):
+        (WebKit::WebMediaPlayerClientImpl::repaint):
+        (WebKit::WebMediaPlayerClientImpl::durationChanged):
+        (WebKit::WebMediaPlayerClientImpl::rateChanged):
+        (WebKit::WebMediaPlayerClientImpl::sizeChanged):
+        (WebKit::WebMediaPlayerClientImpl::sawUnsupportedTracks):
+        (WebKit::WebMediaPlayerClientImpl::load):
+        (WebKit::WebMediaPlayerClientImpl::cancelLoad):
+        (WebKit::WebMediaPlayerClientImpl::play):
+        (WebKit::WebMediaPlayerClientImpl::pause):
+        (WebKit::WebMediaPlayerClientImpl::naturalSize):
+        (WebKit::WebMediaPlayerClientImpl::hasVideo):
+        (WebKit::WebMediaPlayerClientImpl::hasAudio):
+        (WebKit::WebMediaPlayerClientImpl::setVisible):
+        (WebKit::WebMediaPlayerClientImpl::duration):
+        (WebKit::WebMediaPlayerClientImpl::currentTime):
+        (WebKit::WebMediaPlayerClientImpl::seek):
+        (WebKit::WebMediaPlayerClientImpl::seeking):
+        (WebKit::WebMediaPlayerClientImpl::setEndTime):
+        (WebKit::WebMediaPlayerClientImpl::setRate):
+        (WebKit::WebMediaPlayerClientImpl::paused):
+        (WebKit::WebMediaPlayerClientImpl::supportsFullscreen):
+        (WebKit::WebMediaPlayerClientImpl::supportsSave):
+        (WebKit::WebMediaPlayerClientImpl::setVolume):
+        (WebKit::WebMediaPlayerClientImpl::networkState):
+        (WebKit::WebMediaPlayerClientImpl::readyState):
+        (WebKit::WebMediaPlayerClientImpl::maxTimeSeekable):
+        (WebKit::WebMediaPlayerClientImpl::buffered):
+        (WebKit::WebMediaPlayerClientImpl::dataRate):
+        (WebKit::WebMediaPlayerClientImpl::totalBytesKnown):
+        (WebKit::WebMediaPlayerClientImpl::totalBytes):
+        (WebKit::WebMediaPlayerClientImpl::bytesLoaded):
+        (WebKit::WebMediaPlayerClientImpl::setSize):
+        (WebKit::WebMediaPlayerClientImpl::paint):
+        (WebKit::WebMediaPlayerClientImpl::setAutobuffer):
+        (WebKit::WebMediaPlayerClientImpl::hasSingleSecurityOrigin):
+        (WebKit::WebMediaPlayerClientImpl::movieLoadType):
+        (WebKit::WebMediaPlayerClientImpl::create):
+        (WebKit::WebMediaPlayerClientImpl::getSupportedTypes):
+        (WebKit::WebMediaPlayerClientImpl::supportsType):
+        (WebKit::WebMediaPlayerClientImpl::WebMediaPlayerClientImpl):
+        * src/WebMediaPlayerClientImpl.h: Added.
+        * src/WebNode.cpp: Added.
+        (WebKit::WebNode::reset):
+        (WebKit::WebNode::assign):
+        (WebKit::WebNode::parentNode):
+        (WebKit::WebNode::nodeName):
+        (WebKit::WebNode::WebNode):
+        (WebKit::WebNode::operator=):
+        (WebKit::WebNode::operator WTF::PassRefPtr<WebCore::Node>):
+        (WebKit::WebNode::frame):
+        * src/WebNotification.cpp: Added.
+        (WebKit::WebNotification::reset):
+        (WebKit::WebNotification::assign):
+        (WebKit::WebNotification::lessThan):
+        (WebKit::WebNotification::isHTML):
+        (WebKit::WebNotification::url):
+        (WebKit::WebNotification::icon):
+        (WebKit::WebNotification::title):
+        (WebKit::WebNotification::body):
+        (WebKit::WebNotification::dispatchDisplayEvent):
+        (WebKit::WebNotification::dispatchErrorEvent):
+        (WebKit::WebNotification::dispatchCloseEvent):
+        (WebKit::WebNotification::WebNotification):
+        (WebKit::WebNotification::operator=):
+        (WebKit::WebNotification::operator WTF::PassRefPtr<Notification>):
+
+2009-11-09  Yaar Schnitman  <yaar at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
         Up-streaming Chromium API src files: WebFileChooser...WebImageSkia
 
         https://bugs.webkit.org/show_bug.cgi?id=31276
diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp
new file mode 100644
index 0000000..947e4cc
--- /dev/null
+++ b/WebKit/chromium/src/WebInputElement.cpp
@@ -0,0 +1,89 @@
+/*
+ * 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 "WebInputElement.h"
+
+#include "HTMLInputElement.h"
+#include "WebString.h"
+#include <wtf/PassRefPtr.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebInputElement::WebInputElement(const WTF::PassRefPtr<HTMLInputElement>& elem)
+    : WebElement(elem.releaseRef())
+{
+}
+
+WebInputElement& WebInputElement::operator=(const WTF::PassRefPtr<HTMLInputElement>& elem)
+{
+    WebNode::assign(elem.releaseRef());
+    return *this;
+}
+
+WebInputElement::operator WTF::PassRefPtr<HTMLInputElement>() const
+{
+    return PassRefPtr<HTMLInputElement>(static_cast<HTMLInputElement*>(m_private));
+}
+
+void WebInputElement::setActivatedSubmit(bool activated)
+{
+    unwrap<HTMLInputElement>()->setActivatedSubmit(activated);
+}
+
+
+void WebInputElement::setValue(const WebString& value)
+{
+    unwrap<HTMLInputElement>()->setValue(value);
+}
+
+WebString WebInputElement::value()
+{
+    return unwrap<HTMLInputElement>()->value();
+}
+
+
+void WebInputElement::setAutofilled(bool autoFilled)
+{
+    unwrap<HTMLInputElement>()->setAutofilled(autoFilled);
+}
+
+void WebInputElement::dispatchFormControlChangeEvent()
+{
+    unwrap<HTMLInputElement>()->dispatchFormControlChangeEvent();
+} // namespace WebKit
+
+void WebInputElement::setSelectionRange(size_t start, size_t end)
+{
+    unwrap<HTMLInputElement>()->setSelectionRange(start, end);
+}
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebInputEvent.cpp b/WebKit/chromium/src/WebInputEvent.cpp
new file mode 100644
index 0000000..b5c56fa
--- /dev/null
+++ b/WebKit/chromium/src/WebInputEvent.cpp
@@ -0,0 +1,157 @@
+/*
+ * 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 "WebInputEvent.h"
+
+#include "KeyboardCodes.h"
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <wtf/Assertions.h>
+#include <wtf/StringExtras.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static const char* staticKeyIdentifiers(unsigned short keyCode)
+{
+    switch (keyCode) {
+    case VKEY_MENU:
+        return "Alt";
+    case VKEY_CONTROL:
+        return "Control";
+    case VKEY_SHIFT:
+        return "Shift";
+    case VKEY_CAPITAL:
+        return "CapsLock";
+    case VKEY_LWIN:
+    case VKEY_RWIN:
+        return "Win";
+    case VKEY_CLEAR:
+        return "Clear";
+    case VKEY_DOWN:
+        return "Down";
+    case VKEY_END:
+        return "End";
+    case VKEY_RETURN:
+        return "Enter";
+    case VKEY_EXECUTE:
+        return "Execute";
+    case VKEY_F1:
+        return "F1";
+    case VKEY_F2:
+        return "F2";
+    case VKEY_F3:
+        return "F3";
+    case VKEY_F4:
+        return "F4";
+    case VKEY_F5:
+        return "F5";
+    case VKEY_F6:
+        return "F6";
+    case VKEY_F7:
+        return "F7";
+    case VKEY_F8:
+        return "F8";
+    case VKEY_F9:
+        return "F9";
+    case VKEY_F10:
+        return "F11";
+    case VKEY_F12:
+        return "F12";
+    case VKEY_F13:
+        return "F13";
+    case VKEY_F14:
+        return "F14";
+    case VKEY_F15:
+        return "F15";
+    case VKEY_F16:
+        return "F16";
+    case VKEY_F17:
+        return "F17";
+    case VKEY_F18:
+        return "F18";
+    case VKEY_F19:
+        return "F19";
+    case VKEY_F20:
+        return "F20";
+    case VKEY_F21:
+        return "F21";
+    case VKEY_F22:
+        return "F22";
+    case VKEY_F23:
+        return "F23";
+    case VKEY_F24:
+        return "F24";
+    case VKEY_HELP:
+        return "Help";
+    case VKEY_HOME:
+        return "Home";
+    case VKEY_INSERT:
+        return "Insert";
+    case VKEY_LEFT:
+        return "Left";
+    case VKEY_NEXT:
+        return "PageDown";
+    case VKEY_PRIOR:
+        return "PageUp";
+    case VKEY_PAUSE:
+        return "Pause";
+    case VKEY_SNAPSHOT:
+        return "PrintScreen";
+    case VKEY_RIGHT:
+        return "Right";
+    case VKEY_SCROLL:
+        return "Scroll";
+    case VKEY_SELECT:
+        return "Select";
+    case VKEY_UP:
+        return "Up";
+    case VKEY_DELETE:
+        return "U+007F"; // Standard says that DEL becomes U+007F.
+    default:
+        return 0;
+    }
+}
+
+void WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode()
+{
+    const char* id = staticKeyIdentifiers(windowsKeyCode);
+    if (id) {
+        strncpy(keyIdentifier, id, sizeof(keyIdentifier) - 1);
+        keyIdentifier[sizeof(keyIdentifier) - 1] = '\0';
+    } else
+        snprintf(keyIdentifier, sizeof(keyIdentifier), "U+%04X", toupper(windowsKeyCode));
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebInputEventConversion.cpp b/WebKit/chromium/src/WebInputEventConversion.cpp
new file mode 100644
index 0000000..1500129
--- /dev/null
+++ b/WebKit/chromium/src/WebInputEventConversion.cpp
@@ -0,0 +1,256 @@
+/*
+ * 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 "WebInputEventConversion.h"
+
+#include "EventNames.h"
+#include "KeyboardCodes.h"
+#include "KeyboardEvent.h"
+#include "MouseEvent.h"
+#include "PlatformKeyboardEvent.h"
+#include "PlatformMouseEvent.h"
+#include "PlatformWheelEvent.h"
+#include "ScrollView.h"
+#include "WebInputEvent.h"
+#include "Widget.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+// MakePlatformMouseEvent -----------------------------------------------------
+
+PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMouseEvent& e)
+{
+    // FIXME: widget is always toplevel, unless it's a popup.  We may be able
+    // to get rid of this once we abstract popups into a WebKit API.
+    m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y));
+    m_globalPosition = IntPoint(e.globalX, e.globalY);
+    m_button = static_cast<MouseButton>(e.button);
+    m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey);
+    m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey);
+    m_altKey = (e.modifiers & WebInputEvent::AltKey);
+    m_metaKey = (e.modifiers & WebInputEvent::MetaKey);
+    m_modifierFlags = e.modifiers;
+    m_timestamp = e.timeStampSeconds;
+    m_clickCount = e.clickCount;
+
+    switch (e.type) {
+    case WebInputEvent::MouseMove:
+    case WebInputEvent::MouseLeave:  // synthesize a move event
+        m_eventType = MouseEventMoved;
+        break;
+
+    case WebInputEvent::MouseDown:
+        m_eventType = MouseEventPressed;
+        break;
+
+    case WebInputEvent::MouseUp:
+        m_eventType = MouseEventReleased;
+        break;
+
+    default:
+        ASSERT_NOT_REACHED();
+    }
+}
+
+// PlatformWheelEventBuilder --------------------------------------------------
+
+PlatformWheelEventBuilder::PlatformWheelEventBuilder(Widget* widget, const WebMouseWheelEvent& e)
+{
+    m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y));
+    m_globalPosition = IntPoint(e.globalX, e.globalY);
+    m_deltaX = e.deltaX;
+    m_deltaY = e.deltaY;
+    m_wheelTicksX = e.wheelTicksX;
+    m_wheelTicksY = e.wheelTicksY;
+    m_isAccepted = false;
+    m_granularity = e.scrollByPage ?
+        ScrollByPageWheelEvent : ScrollByPixelWheelEvent;
+    m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey);
+    m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey);
+    m_altKey = (e.modifiers & WebInputEvent::AltKey);
+    m_metaKey = (e.modifiers & WebInputEvent::MetaKey);
+}
+
+// MakePlatformKeyboardEvent --------------------------------------------------
+
+static inline const PlatformKeyboardEvent::Type toPlatformKeyboardEventType(WebInputEvent::Type type)
+{
+    switch (type) {
+    case WebInputEvent::KeyUp:
+        return PlatformKeyboardEvent::KeyUp;
+    case WebInputEvent::KeyDown:
+        return PlatformKeyboardEvent::KeyDown;
+    case WebInputEvent::RawKeyDown:
+        return PlatformKeyboardEvent::RawKeyDown;
+    case WebInputEvent::Char:
+        return PlatformKeyboardEvent::Char;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+    return PlatformKeyboardEvent::KeyDown;
+}
+
+PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEvent& e)
+{
+    m_type = toPlatformKeyboardEventType(e.type);
+    m_text = String(e.text);
+    m_unmodifiedText = String(e.unmodifiedText);
+    m_keyIdentifier = String(e.keyIdentifier);
+    m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat);
+    m_windowsVirtualKeyCode = e.windowsKeyCode;
+    m_nativeVirtualKeyCode = e.nativeKeyCode;
+    m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad);
+    m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey);
+    m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey);
+    m_altKey = (e.modifiers & WebInputEvent::AltKey);
+    m_metaKey = (e.modifiers & WebInputEvent::MetaKey);
+    m_isSystemKey = e.isSystemKey;
+}
+
+void PlatformKeyboardEventBuilder::setKeyType(Type type)
+{
+    // According to the behavior of Webkit in Windows platform,
+    // we need to convert KeyDown to RawKeydown and Char events
+    // See WebKit/WebKit/Win/WebView.cpp
+    ASSERT(m_type == KeyDown);
+    ASSERT(type == RawKeyDown || type == Char);
+    m_type = type;
+
+    if (type == RawKeyDown) {
+        m_text = String();
+        m_unmodifiedText = String();
+    } else {
+        m_keyIdentifier = String();
+        m_windowsVirtualKeyCode = 0;
+    }
+}
+
+// Please refer to bug http://b/issue?id=961192, which talks about Webkit
+// keyboard event handling changes. It also mentions the list of keys
+// which don't have associated character events.
+bool PlatformKeyboardEventBuilder::isCharacterKey() const
+{
+    switch (windowsVirtualKeyCode()) {
+    case VKEY_BACK:
+    case VKEY_ESCAPE:
+        return false;
+    }
+    return true;
+}
+
+static int getWebInputModifiers(const UIEventWithKeyState& event)
+{
+    int modifiers = 0;
+    if (event.ctrlKey())
+        modifiers |= WebInputEvent::ControlKey;
+    if (event.shiftKey())
+        modifiers |= WebInputEvent::ShiftKey;
+    if (event.altKey())
+        modifiers |= WebInputEvent::AltKey;
+    if (event.metaKey())
+        modifiers |= WebInputEvent::MetaKey;
+    return modifiers;
+}
+
+WebMouseEventBuilder::WebMouseEventBuilder(const ScrollView* view, const MouseEvent& event)
+{
+    if (event.type() == eventNames().mousemoveEvent)
+        type = WebInputEvent::MouseMove;
+    else if (event.type() == eventNames().mouseoutEvent)
+        type = WebInputEvent::MouseLeave;
+    else if (event.type() == eventNames().mouseoverEvent)
+        type = WebInputEvent::MouseEnter;
+    else if (event.type() == eventNames().mousedownEvent)
+        type = WebInputEvent::MouseDown;
+    else if (event.type() == eventNames().mouseupEvent)
+        type = WebInputEvent::MouseUp;
+    else
+        return; // Skip all other mouse events.
+    timeStampSeconds = event.timeStamp() * 1.0e-3;
+    switch (event.button()) {
+    case LeftButton:
+        button = WebMouseEvent::ButtonLeft;
+        break;
+    case MiddleButton:
+        button = WebMouseEvent::ButtonMiddle;
+        break;
+    case RightButton:
+        button = WebMouseEvent::ButtonRight;
+        break;
+    }
+    modifiers = getWebInputModifiers(event);
+    if (event.buttonDown()) {
+        switch (event.button()) {
+        case LeftButton:
+            modifiers |= WebInputEvent::LeftButtonDown;
+            break;
+        case MiddleButton:
+            modifiers |= WebInputEvent::MiddleButtonDown;
+            break;
+        case RightButton:
+            modifiers |= WebInputEvent::RightButtonDown;
+            break;
+        }
+    }
+    IntPoint p = view->contentsToWindow(IntPoint(event.pageX(), event.pageY()));
+    globalX = event.screenX();
+    globalY = event.screenY();
+    windowX = p.x();
+    windowY = p.y();
+    x = event.offsetX();
+    y = event.offsetY();
+}
+
+WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event)
+{
+    if (event.type() == eventNames().keydownEvent)
+        type = KeyDown;
+    else if (event.type() == eventNames().keyupEvent)
+        type = WebInputEvent::KeyUp;
+    else if (event.type() == eventNames().keypressEvent)
+        type = WebInputEvent::Char;
+    else
+        return; // Skip all other keyboard events.
+    modifiers = getWebInputModifiers(event);
+    timeStampSeconds = event.timeStamp() * 1.0e-3;
+    windowsKeyCode = event.keyCode();
+    nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode();
+    unsigned int numChars = std::min(event.keyEvent()->text().length(),
+        static_cast<unsigned int>(WebKeyboardEvent::textLengthCap));
+    for (unsigned int i = 0; i < numChars; i++) {
+        text[i] = event.keyEvent()->text()[i];
+        unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i];
+    }
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebInputEventConversion.h b/WebKit/chromium/src/WebInputEventConversion.h
new file mode 100644
index 0000000..4c9cf82
--- /dev/null
+++ b/WebKit/chromium/src/WebInputEventConversion.h
@@ -0,0 +1,96 @@
+/*
+ * 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 WebInputEventConversion_h
+#define WebInputEventConversion_h
+
+// FIXME: This relative path is a temporary hack to support using this
+// header from webkit/glue.
+#include "../public/WebInputEvent.h"
+
+#include "PlatformKeyboardEvent.h"
+#include "PlatformMouseEvent.h"
+#include "PlatformWheelEvent.h"
+
+namespace WebCore {
+class KeyboardEvent;
+class MouseEvent;
+class ScrollView;
+class Widget;
+}
+
+namespace WebKit {
+
+class WebMouseEvent;
+class WebMouseWheelEvent;
+class WebKeyboardEvent;
+
+// These classes are used to convert from WebInputEvent subclasses to
+// corresponding WebCore events.
+
+class PlatformMouseEventBuilder : public WebCore::PlatformMouseEvent {
+public:
+    PlatformMouseEventBuilder(WebCore::Widget*, const WebMouseEvent&);
+};
+
+class PlatformWheelEventBuilder : public WebCore::PlatformWheelEvent {
+public:
+    PlatformWheelEventBuilder(WebCore::Widget*, const WebMouseWheelEvent&);
+};
+
+class PlatformKeyboardEventBuilder : public WebCore::PlatformKeyboardEvent {
+public:
+    PlatformKeyboardEventBuilder(const WebKeyboardEvent&);
+    void setKeyType(Type);
+    bool isCharacterKey() const;
+};
+
+// Converts a WebCore::MouseEvent to a corresponding WebMouseEvent. view is
+// the ScrollView corresponding to the event.  Returns true if successful.
+// NOTE: This is only implemented for mousemove, mouseover, mouseout,
+// mousedown and mouseup.  If the event mapping fails, the event type will
+// be set to Undefined.
+class WebMouseEventBuilder : public WebMouseEvent {
+public:
+    WebMouseEventBuilder(const WebCore::ScrollView*, const WebCore::MouseEvent&);
+};
+
+// Converts a WebCore::KeyboardEvent to a corresponding WebKeyboardEvent.
+// Returns true if successful.  NOTE: This is only implemented for keydown
+// and keyup.  If the event mapping fails, the event type will be set to
+// Undefined.
+class WebKeyboardEventBuilder : public WebKeyboardEvent {
+public:
+    WebKeyboardEventBuilder(const WebCore::KeyboardEvent&);
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/src/WebKit.cpp b/WebKit/chromium/src/WebKit.cpp
new file mode 100644
index 0000000..a129f85
--- /dev/null
+++ b/WebKit/chromium/src/WebKit.cpp
@@ -0,0 +1,102 @@
+/*
+ * 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 "WebKit.h"
+
+#include "AtomicString.h"
+#include "DOMTimer.h"
+#include "Page.h"
+#include "RuntimeEnabledFeatures.h"
+#include "TextEncoding.h"
+#include "WebMediaPlayerClientImpl.h"
+#include "WebSocket.h"
+#include "WorkerContextExecutionProxy.h"
+
+#include <wtf/Assertions.h>
+#include <wtf/Threading.h>
+
+namespace WebKit {
+
+static WebKitClient* s_webKitClient = 0;
+static bool s_layoutTestMode = false;
+
+void initialize(WebKitClient* webKitClient)
+{
+    ASSERT(webKitClient);
+    ASSERT(!s_webKitClient);
+    s_webKitClient = webKitClient;
+
+    WTF::initializeThreading();
+    WebCore::AtomicString::init();
+
+    // Chromium sets the minimum interval timeout to 4ms, overriding the
+    // default of 10ms.  We'd like to go lower, however there are poorly
+    // coded websites out there which do create CPU-spinning loops.  Using
+    // 4ms prevents the CPU from spinning too busily and provides a balance
+    // between CPU spinning and the smallest possible interval timer.
+    WebCore::DOMTimer::setMinTimerInterval(0.004);
+
+    // There are some code paths (for example, running WebKit in the browser
+    // process and calling into LocalStorage before anything else) where the
+    // UTF8 string encoding tables are used on a background thread before
+    // they're set up.  This is a problem because their set up routines assert
+    // they're running on the main WebKitThread.  It might be possible to make
+    // the initialization thread-safe, but given that so many code paths use
+    // this, initializing this lazily probably doesn't buy us much.
+    WebCore::UTF8Encoding();
+}
+
+void shutdown()
+{
+    s_webKitClient = 0;
+}
+
+WebKitClient* webKitClient()
+{
+    return s_webKitClient;
+}
+
+void setLayoutTestMode(bool value)
+{
+    s_layoutTestMode = value;
+}
+
+bool layoutTestMode()
+{
+    return s_layoutTestMode;
+}
+
+void resetPluginCache(bool reloadPages)
+{
+    WebCore::Page::refreshPlugins(reloadPages);
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
new file mode 100644
index 0000000..c2a3535
--- /dev/null
+++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
@@ -0,0 +1,397 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "WebMediaPlayerClientImpl.h"
+
+#if ENABLE(VIDEO)
+
+#include "CString.h"
+#include "Frame.h"
+#include "GraphicsContext.h"
+#include "HTMLMediaElement.h"
+#include "IntSize.h"
+#include "KURL.h"
+#include "MediaPlayer.h"
+#include "NotImplemented.h"
+#include "TimeRanges.h"
+
+#include "WebCanvas.h"
+#include "WebCString.h"
+#include "WebFrameClient.h"
+#include "WebFrameImpl.h"
+#include "WebKit.h"
+#include "WebKitClient.h"
+#include "WebMediaPlayer.h"
+#include "WebMimeRegistry.h"
+#include "WebRect.h"
+#include "WebSize.h"
+#include "WebString.h"
+#include "WebURL.h"
+
+// WebCommon.h defines WEBKIT_USING_SKIA so this has to be included last.
+#if WEBKIT_USING_SKIA
+#include "PlatformContextSkia.h"
+#endif
+
+#include <wtf/Assertions.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static WebMediaPlayer* createWebMediaPlayer(
+    WebMediaPlayerClient* client, Frame* frame)
+{
+    WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame);
+    if (!webFrame->client())
+        return 0;
+    return webFrame->client()->createMediaPlayer(webFrame, client);
+}
+
+bool WebMediaPlayerClientImpl::m_isEnabled = false;
+
+bool WebMediaPlayerClientImpl::isEnabled()
+{
+    return m_isEnabled;
+}
+
+void WebMediaPlayerClientImpl::setIsEnabled(bool isEnabled)
+{
+    m_isEnabled = isEnabled;
+}
+
+void WebMediaPlayerClientImpl::registerSelf(MediaEngineRegistrar registrar)
+{
+    if (m_isEnabled) {
+        registrar(WebMediaPlayerClientImpl::create,
+                  WebMediaPlayerClientImpl::getSupportedTypes,
+                  WebMediaPlayerClientImpl::supportsType);
+    }
+}
+
+// WebMediaPlayerClient --------------------------------------------------------
+
+void WebMediaPlayerClientImpl::networkStateChanged()
+{
+    ASSERT(m_mediaPlayer);
+    m_mediaPlayer->networkStateChanged();
+}
+
+void WebMediaPlayerClientImpl::readyStateChanged()
+{
+    ASSERT(m_mediaPlayer);
+    m_mediaPlayer->readyStateChanged();
+}
+
+void WebMediaPlayerClientImpl::volumeChanged()
+{
+    ASSERT(m_mediaPlayer);
+    m_mediaPlayer->volumeChanged();
+}
+
+void WebMediaPlayerClientImpl::timeChanged()
+{
+    ASSERT(m_mediaPlayer);
+    m_mediaPlayer->timeChanged();
+}
+
+void WebMediaPlayerClientImpl::repaint()
+{
+    ASSERT(m_mediaPlayer);
+    m_mediaPlayer->repaint();
+}
+
+void WebMediaPlayerClientImpl::durationChanged()
+{
+    ASSERT(m_mediaPlayer);
+    m_mediaPlayer->durationChanged();
+}
+
+void WebMediaPlayerClientImpl::rateChanged()
+{
+    ASSERT(m_mediaPlayer);
+    m_mediaPlayer->rateChanged();
+}
+
+void WebMediaPlayerClientImpl::sizeChanged()
+{
+    ASSERT(m_mediaPlayer);
+    m_mediaPlayer->sizeChanged();
+}
+
+void WebMediaPlayerClientImpl::sawUnsupportedTracks()
+{
+    ASSERT(m_mediaPlayer);
+    m_mediaPlayer->mediaPlayerClient()->mediaPlayerSawUnsupportedTracks(m_mediaPlayer);
+}
+
+// MediaPlayerPrivateInterface -------------------------------------------------
+
+void WebMediaPlayerClientImpl::load(const String& url)
+{
+    Frame* frame = static_cast<HTMLMediaElement*>(
+        m_mediaPlayer->mediaPlayerClient())->document()->frame();
+    m_webMediaPlayer.set(createWebMediaPlayer(this, frame));
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->load(KURL(ParsedURLString, url));
+}
+
+void WebMediaPlayerClientImpl::cancelLoad()
+{
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->cancelLoad();
+}
+
+void WebMediaPlayerClientImpl::play()
+{
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->play();
+}
+
+void WebMediaPlayerClientImpl::pause()
+{
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->pause();
+}
+
+IntSize WebMediaPlayerClientImpl::naturalSize() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->naturalSize();
+    return IntSize();
+}
+
+bool WebMediaPlayerClientImpl::hasVideo() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->hasVideo();
+    return false;
+}
+
+bool WebMediaPlayerClientImpl::hasAudio() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->hasAudio();
+    return false;
+}
+
+void WebMediaPlayerClientImpl::setVisible(bool visible)
+{
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->setVisible(visible);
+}
+
+float WebMediaPlayerClientImpl::duration() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->duration();
+    return 0.0f;
+}
+
+float WebMediaPlayerClientImpl::currentTime() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->currentTime();
+    return 0.0f;
+}
+
+void WebMediaPlayerClientImpl::seek(float time)
+{
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->seek(time);
+}
+
+bool WebMediaPlayerClientImpl::seeking() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->seeking();
+    return false;
+}
+
+void WebMediaPlayerClientImpl::setEndTime(float time)
+{
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->setEndTime(time);
+}
+
+void WebMediaPlayerClientImpl::setRate(float rate)
+{
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->setRate(rate);
+}
+
+bool WebMediaPlayerClientImpl::paused() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->paused();
+    return false;
+}
+
+bool WebMediaPlayerClientImpl::supportsFullscreen() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->supportsFullscreen();
+    return false;
+}
+
+bool WebMediaPlayerClientImpl::supportsSave() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->supportsSave();
+    return false;
+}
+
+void WebMediaPlayerClientImpl::setVolume(float volume)
+{
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->setVolume(volume);
+}
+
+MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const
+{
+    if (m_webMediaPlayer.get())
+        return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkState());
+    return MediaPlayer::Empty;
+}
+
+MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const
+{
+    if (m_webMediaPlayer.get())
+        return static_cast<MediaPlayer::ReadyState>(m_webMediaPlayer->readyState());
+    return MediaPlayer::HaveNothing;
+}
+
+float WebMediaPlayerClientImpl::maxTimeSeekable() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->maxTimeSeekable();
+    return 0.0f;
+}
+
+PassRefPtr<TimeRanges> WebMediaPlayerClientImpl::buffered() const
+{
+    if (m_webMediaPlayer.get()) {
+        const WebTimeRanges& webRanges = m_webMediaPlayer->buffered();
+
+        // FIXME: Save the time ranges in a member variable and update it when needed.
+        RefPtr<TimeRanges> ranges = TimeRanges::create();
+        for (size_t i = 0; i < webRanges.size(); ++i)
+            ranges->add(webRanges[i].start, webRanges[i].end);
+        return ranges.release();
+    }
+    return TimeRanges::create();
+}
+
+int WebMediaPlayerClientImpl::dataRate() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->dataRate();
+    return 0;
+}
+
+bool WebMediaPlayerClientImpl::totalBytesKnown() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->totalBytesKnown();
+    return false;
+}
+
+unsigned WebMediaPlayerClientImpl::totalBytes() const
+{
+    if (m_webMediaPlayer.get())
+        return static_cast<unsigned>(m_webMediaPlayer->totalBytes());
+    return 0;
+}
+
+unsigned WebMediaPlayerClientImpl::bytesLoaded() const
+{
+    if (m_webMediaPlayer.get())
+        return static_cast<unsigned>(m_webMediaPlayer->bytesLoaded());
+    return 0;
+}
+
+void WebMediaPlayerClientImpl::setSize(const IntSize& size)
+{
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->setSize(WebSize(size.width(), size.height()));
+}
+
+void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& rect)
+{
+    // Normally GraphicsContext operations do nothing when painting is disabled.
+    // Since we're accessing platformContext() directly we have to manually
+    // check.
+    if (m_webMediaPlayer.get() && !context->paintingDisabled()) {
+#if WEBKIT_USING_SKIA
+        m_webMediaPlayer->paint(context->platformContext()->canvas(), rect);
+#elif WEBKIT_USING_CG
+        m_webMediaPlayer->paint(context->platformContext(), rect);
+#else
+        notImplemented();
+#endif
+    }
+}
+
+void WebMediaPlayerClientImpl::setAutobuffer(bool autoBuffer)
+{
+    if (m_webMediaPlayer.get())
+        m_webMediaPlayer->setAutoBuffer(autoBuffer);
+}
+
+bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const
+{
+    if (m_webMediaPlayer.get())
+        return m_webMediaPlayer->hasSingleSecurityOrigin();
+    return false;
+}
+
+MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const
+{
+    if (m_webMediaPlayer.get())
+        return static_cast<MediaPlayer::MovieLoadType>(
+            m_webMediaPlayer->movieLoadType());
+    return MediaPlayer::Unknown;
+}
+
+MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* player)
+{
+    WebMediaPlayerClientImpl* client = new WebMediaPlayerClientImpl();
+    client->m_mediaPlayer = player;
+    return client;
+}
+
+void WebMediaPlayerClientImpl::getSupportedTypes(HashSet<String>& supportedTypes)
+{
+    // FIXME: integrate this list with WebMediaPlayerClientImpl::supportsType.
+    notImplemented();
+}
+
+MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(const String& type,
+                                                                 const String& codecs)
+{
+    WebMimeRegistry::SupportsType supportsType =
+        webKitClient()->mimeRegistry()->supportsMediaMIMEType(type, codecs);
+
+    switch (supportsType) {
+    default:
+        ASSERT_NOT_REACHED();
+    case WebMimeRegistry::IsNotSupported:
+        return MediaPlayer::IsNotSupported;
+    case WebMimeRegistry::IsSupported:
+        return MediaPlayer::IsSupported;
+    case WebMimeRegistry::MayBeSupported:
+        return MediaPlayer::MayBeSupported;
+    }
+    return MediaPlayer::IsNotSupported;
+}
+
+WebMediaPlayerClientImpl::WebMediaPlayerClientImpl()
+    : m_mediaPlayer(0)
+{
+}
+
+} // namespace WebKit
+
+#endif  // ENABLE(VIDEO)
diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/WebKit/chromium/src/WebMediaPlayerClientImpl.h
new file mode 100644
index 0000000..7f087d0
--- /dev/null
+++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.h
@@ -0,0 +1,114 @@
+/*
+ * 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 WebMediaPlayerClientImpl_h
+#define WebMediaPlayerClientImpl_h
+
+#if ENABLE(VIDEO)
+
+#include "MediaPlayerPrivate.h"
+#include "WebMediaPlayerClient.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebKit {
+
+class WebMediaPlayer;
+
+// This class serves as a bridge between WebCore::MediaPlayer and
+// WebKit::WebMediaPlayer.
+class WebMediaPlayerClientImpl : public WebMediaPlayerClient
+                               , public WebCore::MediaPlayerPrivateInterface {
+public:
+    static bool isEnabled();
+    static void setIsEnabled(bool);
+    static void registerSelf(WebCore::MediaEngineRegistrar);
+
+    // WebMediaPlayerClient methods:
+    virtual void networkStateChanged();
+    virtual void readyStateChanged();
+    virtual void volumeChanged();
+    virtual void timeChanged();
+    virtual void repaint();
+    virtual void durationChanged();
+    virtual void rateChanged();
+    virtual void sizeChanged();
+    virtual void sawUnsupportedTracks();
+
+    // MediaPlayerPrivateInterface methods:
+    virtual void load(const WebCore::String& url);
+    virtual void cancelLoad();
+    virtual void play();
+    virtual void pause();
+    virtual bool supportsFullscreen() const;
+    virtual bool supportsSave() const;
+    virtual WebCore::IntSize naturalSize() const;
+    virtual bool hasVideo() const;
+    virtual bool hasAudio() const;
+    virtual void setVisible(bool);
+    virtual float duration() const;
+    virtual float currentTime() const;
+    virtual void seek(float time);
+    virtual bool seeking() const;
+    virtual void setEndTime(float time);
+    virtual void setRate(float);
+    virtual bool paused() const;
+    virtual void setVolume(float);
+    virtual WebCore::MediaPlayer::NetworkState networkState() const;
+    virtual WebCore::MediaPlayer::ReadyState readyState() const;
+    virtual float maxTimeSeekable() const;
+    virtual WTF::PassRefPtr<WebCore::TimeRanges> buffered() const;
+    virtual int dataRate() const;
+    virtual void setAutobuffer(bool);
+    virtual bool totalBytesKnown() const;
+    virtual unsigned totalBytes() const;
+    virtual unsigned bytesLoaded() const;
+    virtual void setSize(const WebCore::IntSize&);
+    virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&);
+    virtual bool hasSingleSecurityOrigin() const;
+    virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const;
+
+private:
+    WebMediaPlayerClientImpl();
+
+    static WebCore::MediaPlayerPrivateInterface* create(WebCore::MediaPlayer*);
+    static void getSupportedTypes(WTF::HashSet<WebCore::String>&);
+    static WebCore::MediaPlayer::SupportsType supportsType(
+        const WebCore::String& type, const WebCore::String& codecs);
+
+    WebCore::MediaPlayer* m_mediaPlayer;
+    OwnPtr<WebMediaPlayer> m_webMediaPlayer;
+    static bool m_isEnabled;
+};
+
+} // namespace WebKit
+
+#endif
+
+#endif
diff --git a/WebKit/chromium/src/WebNode.cpp b/WebKit/chromium/src/WebNode.cpp
new file mode 100644
index 0000000..de676c3
--- /dev/null
+++ b/WebKit/chromium/src/WebNode.cpp
@@ -0,0 +1,106 @@
+/*
+ * 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 "WebNode.h"
+
+#include "Document.h"
+#include "Frame.h"
+#include "FrameLoaderClientImpl.h"
+#include "Node.h"
+
+#include "WebFrameImpl.h"
+#include "WebString.h"
+
+#include <wtf/PassRefPtr.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class WebNodePrivate : public Node {
+};
+
+void WebNode::reset()
+{
+    assign(0);
+}
+
+void WebNode::assign(const WebNode& other)
+{
+    WebNodePrivate* p = const_cast<WebNodePrivate*>(other.m_private);
+    if (p)
+        p->ref();
+    assign(p);
+}
+
+WebNode WebNode::parentNode() const
+{
+    return PassRefPtr<Node>(const_cast<Node*>(m_private->parentNode()));
+}
+
+WebString WebNode::nodeName() const
+{
+    return m_private->nodeName();
+}
+
+WebNode::WebNode(const WTF::PassRefPtr<WebCore::Node>& node)
+    : m_private(static_cast<WebNodePrivate*>(node.releaseRef()))
+{
+}
+
+WebNode& WebNode::operator=(const WTF::PassRefPtr<WebCore::Node>& node)
+{
+    assign(static_cast<WebNodePrivate*>(node.releaseRef()));
+    return *this;
+}
+
+WebNode::operator WTF::PassRefPtr<WebCore::Node>() const
+{
+    return PassRefPtr<Node>(const_cast<WebNodePrivate*>(m_private));
+}
+
+void WebNode::assign(WebNodePrivate* p)
+{
+    // p is already ref'd for us by the caller
+    if (m_private)
+        m_private->deref();
+    m_private = p;
+}
+
+WebFrame* WebNode::frame()
+{
+    FrameLoaderClientImpl* frame_loader_client =
+        static_cast<FrameLoaderClientImpl*>(m_private->document()->
+                                            frame()->loader()->client());
+    return static_cast<WebFrame*>(frame_loader_client->webFrame());
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebNotification.cpp b/WebKit/chromium/src/WebNotification.cpp
new file mode 100644
index 0000000..1f6916e
--- /dev/null
+++ b/WebKit/chromium/src/WebNotification.cpp
@@ -0,0 +1,143 @@
+/*
+ * 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 "WebNotification.h"
+
+#if ENABLE(NOTIFICATIONS)
+
+#include "Notification.h"
+
+#include "WebString.h"
+#include "WebURL.h"
+
+#include <wtf/PassRefPtr.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class WebNotificationPrivate : public Notification {
+};
+
+void WebNotification::reset()
+{
+    assign(0);
+}
+
+void WebNotification::assign(const WebNotification& other)
+{
+    WebNotificationPrivate* p = const_cast<WebNotificationPrivate*>(other.m_private);
+    if (p)
+        p->ref();
+    assign(p);
+}
+
+bool WebNotification::lessThan(const WebNotification& other) const
+{
+    return reinterpret_cast<uintptr_t>(m_private) < reinterpret_cast<uintptr_t>(other.m_private);
+}
+
+bool WebNotification::isHTML() const
+{
+    return m_private->isHTML();
+}
+
+WebURL WebNotification::url() const
+{
+    ASSERT(isHTML());
+    return m_private->url();
+}
+
+WebString WebNotification::icon() const
+{
+    ASSERT(!isHTML());
+    return m_private->contents().icon();
+}
+
+WebString WebNotification::title() const
+{
+    ASSERT(!isHTML());
+    return m_private->contents().title();
+}
+
+WebString WebNotification::body() const
+{
+    ASSERT(!isHTML());
+    return m_private->contents().body();
+}
+
+void WebNotification::dispatchDisplayEvent()
+{
+    RefPtr<Event> event = Event::create("display", false, true);
+    m_private->dispatchEvent(event.release());
+}
+
+void WebNotification::dispatchErrorEvent(const WebKit::WebString& /* errorMessage */)
+{
+    // FIXME: errorMessage not supported by WebCore yet
+    RefPtr<Event> event = Event::create(eventNames().errorEvent, false, true);
+    m_private->dispatchEvent(event.release());
+}
+
+void WebNotification::dispatchCloseEvent(bool /* byUser */)
+{
+    // FIXME: byUser flag not supported by WebCore yet
+    RefPtr<Event> event = Event::create(eventNames().closeEvent, false, true);
+    m_private->dispatchEvent(event.release());
+}
+
+WebNotification::WebNotification(const WTF::PassRefPtr<Notification>& notification)
+    : m_private(static_cast<WebNotificationPrivate*>(notification.releaseRef()))
+{
+}
+
+WebNotification& WebNotification::operator=(const WTF::PassRefPtr<Notification>& notification)
+{
+    assign(static_cast<WebNotificationPrivate*>(notification.releaseRef()));
+    return *this;
+}
+
+WebNotification::operator WTF::PassRefPtr<Notification>() const
+{
+    return WTF::PassRefPtr<Notification>(const_cast<WebNotificationPrivate*>(m_private));
+}
+
+void WebNotification::assign(WebNotificationPrivate* p)
+{
+    // p is already ref'd for us by the caller
+    if (m_private)
+        m_private->deref();
+    m_private = p;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(NOTIFICATIONS)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list