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

japhet at chromium.org japhet at chromium.org
Wed Apr 7 23:27:41 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit b54241d459422afc8c9877f085924511f0ae1235
Author: japhet at chromium.org <japhet at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 9 22:00:56 2009 +0000

    2009-11-09  Nate Chapin  <japhet at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            Upstream rest of WebH*.h and WebI*.h Chromium API headers.
    
            https://bugs.webkit.org/show_bug.cgi?id=28394
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50689 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 60ee5b8..ba52e43 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,40 @@
+2009-11-09  Nate Chapin  <japhet at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Upstream rest of WebH*.h and WebI*.h Chromium API headers.
+
+        https://bugs.webkit.org/show_bug.cgi?id=28394
+
+        * public/WebHTTPBody.h: Added.
+        (WebKit::WebHTTPBody::Element::):
+        (WebKit::WebHTTPBody::~WebHTTPBody):
+        (WebKit::WebHTTPBody::WebHTTPBody):
+        (WebKit::WebHTTPBody::operator=):
+        (WebKit::WebHTTPBody::isNull):
+        * public/WebHTTPHeaderVisitor.h: Added.
+        (WebKit::WebHTTPHeaderVisitor::~WebHTTPHeaderVisitor):
+        * public/WebHistoryItem.h: Added.
+        (WebKit::WebHistoryItem::~WebHistoryItem):
+        (WebKit::WebHistoryItem::WebHistoryItem):
+        (WebKit::WebHistoryItem::operator=):
+        (WebKit::WebHistoryItem::isNull):
+        * public/WebImage.h: Added.
+        (WebKit::WebImage::~WebImage):
+        (WebKit::WebImage::WebImage):
+        (WebKit::WebImage::operator=):
+        (WebKit::WebImage::getSkBitmap):
+        (WebKit::WebImage::init):
+        (WebKit::WebImage::getCGImageRef):
+        * public/WebInputEvent.h: Added.
+        (WebKit::WebInputEvent::WebInputEvent):
+        (WebKit::WebInputEvent::):
+        (WebKit::WebInputEvent::isKeyboardEventType):
+        (WebKit::WebKeyboardEvent::WebKeyboardEvent):
+        (WebKit::WebMouseEvent::):
+        (WebKit::WebMouseEvent::WebMouseEvent):
+        (WebKit::WebMouseWheelEvent::WebMouseWheelEvent):
+
 2009-11-09  Yaar Schnitman  <yaar at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKit/chromium/public/WebHTTPBody.h b/WebKit/chromium/public/WebHTTPBody.h
new file mode 100644
index 0000000..43f51a6
--- /dev/null
+++ b/WebKit/chromium/public/WebHTTPBody.h
@@ -0,0 +1,101 @@
+/*
+ * 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 WebHTTPBody_h
+#define WebHTTPBody_h
+
+#include "WebData.h"
+#include "WebNonCopyable.h"
+#include "WebString.h"
+
+#if WEBKIT_IMPLEMENTATION
+namespace WebCore { class FormData; }
+namespace WTF { template <typename T> class PassRefPtr; }
+#endif
+
+namespace WebKit {
+
+class WebHTTPBodyPrivate;
+
+class WebHTTPBody {
+public:
+    struct Element {
+        enum { TypeData, TypeFile } type;
+        WebData data;
+        WebString filePath;
+    };
+
+    ~WebHTTPBody() { reset(); }
+
+    WebHTTPBody() : m_private(0) { }
+    WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); }
+    WebHTTPBody& operator=(const WebHTTPBody& b)
+    {
+        assign(b);
+        return *this;
+    }
+
+    WEBKIT_API void initialize();
+    WEBKIT_API void reset();
+    WEBKIT_API void assign(const WebHTTPBody&);
+
+    bool isNull() const { return !m_private; }
+
+    // Returns the number of elements comprising the http body.
+    WEBKIT_API size_t elementCount() const;
+
+    // Sets the values of the element at the given index.  Returns false if
+    // index is out of bounds.
+    WEBKIT_API bool elementAt(size_t index, Element&) const;
+
+    // Append to the list of elements.
+    WEBKIT_API void appendData(const WebData&);
+    WEBKIT_API void appendFile(const WebString&);
+
+    // Identifies a particular form submission instance.  A value of 0 is
+    // used to indicate an unspecified identifier.
+    WEBKIT_API long long identifier() const;
+    WEBKIT_API void setIdentifier(long long);
+
+#if WEBKIT_IMPLEMENTATION
+    WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&);
+    WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&);
+    operator WTF::PassRefPtr<WebCore::FormData>() const;
+#endif
+
+private:
+    void assign(WebHTTPBodyPrivate*);
+    void ensureMutable();
+    WebHTTPBodyPrivate* m_private;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebHTTPHeaderVisitor.h b/WebKit/chromium/public/WebHTTPHeaderVisitor.h
new file mode 100644
index 0000000..2ca86c0
--- /dev/null
+++ b/WebKit/chromium/public/WebHTTPHeaderVisitor.h
@@ -0,0 +1,48 @@
+/*
+ * 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 WebHTTPHeaderVisitor_h
+#define WebHTTPHeaderVisitor_h
+
+namespace WebKit {
+
+class WebString;
+
+class WebHTTPHeaderVisitor {
+public:
+    virtual void visitHeader(const WebString& name, const WebString& value) = 0;
+
+protected:
+    ~WebHTTPHeaderVisitor() { }
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebHistoryItem.h b/WebKit/chromium/public/WebHistoryItem.h
new file mode 100644
index 0000000..f15a62c
--- /dev/null
+++ b/WebKit/chromium/public/WebHistoryItem.h
@@ -0,0 +1,132 @@
+/*
+ * 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 WebHistoryItem_h
+#define WebHistoryItem_h
+
+#include "WebCommon.h"
+
+#if WEBKIT_IMPLEMENTATION
+namespace WebCore { class HistoryItem; }
+namespace WTF { template <typename T> class PassRefPtr; }
+#endif
+
+namespace WebKit {
+
+class WebHistoryItemPrivate;
+class WebHTTPBody;
+class WebString;
+struct WebPoint;
+template <typename T> class WebVector;
+
+// Represents a frame-level navigation entry in session history.  A
+// WebHistoryItem is a node in a tree.
+//
+// Copying a WebHistoryItem is cheap.
+//
+class WebHistoryItem {
+public:
+    ~WebHistoryItem() { reset(); }
+
+    WebHistoryItem() : m_private(0) { }
+    WebHistoryItem(const WebHistoryItem& h) : m_private(0) { assign(h); }
+    WebHistoryItem& operator=(const WebHistoryItem& h)
+    {
+        assign(h);
+        return *this;
+    }
+
+    WEBKIT_API void initialize();
+    WEBKIT_API void reset();
+    WEBKIT_API void assign(const WebHistoryItem&);
+
+    bool isNull() const { return !m_private; }
+
+    WEBKIT_API WebString urlString() const;
+    WEBKIT_API void setURLString(const WebString&);
+
+    WEBKIT_API WebString originalURLString() const;
+    WEBKIT_API void setOriginalURLString(const WebString&);
+
+    WEBKIT_API WebString referrer() const;
+    WEBKIT_API void setReferrer(const WebString&);
+
+    WEBKIT_API WebString target() const;
+    WEBKIT_API void setTarget(const WebString&);
+
+    WEBKIT_API WebString parent() const;
+    WEBKIT_API void setParent(const WebString&);
+
+    WEBKIT_API WebString title() const;
+    WEBKIT_API void setTitle(const WebString&);
+
+    WEBKIT_API WebString alternateTitle() const;
+    WEBKIT_API void setAlternateTitle(const WebString&);
+
+    WEBKIT_API double lastVisitedTime() const;
+    WEBKIT_API void setLastVisitedTime(double);
+
+    WEBKIT_API WebPoint scrollOffset() const;
+    WEBKIT_API void setScrollOffset(const WebPoint&);
+
+    WEBKIT_API bool isTargetItem() const;
+    WEBKIT_API void setIsTargetItem(bool);
+
+    WEBKIT_API int visitCount() const;
+    WEBKIT_API void setVisitCount(int);
+
+    WEBKIT_API WebVector<WebString> documentState() const;
+    WEBKIT_API void setDocumentState(const WebVector<WebString>&);
+
+    WEBKIT_API WebString httpContentType() const;
+    WEBKIT_API void setHTTPContentType(const WebString&);
+
+    WEBKIT_API WebHTTPBody httpBody() const;
+    WEBKIT_API void setHTTPBody(const WebHTTPBody&);
+
+    WEBKIT_API WebVector<WebHistoryItem> children() const;
+    WEBKIT_API void setChildren(const WebVector<WebHistoryItem>&);
+    WEBKIT_API void appendToChildren(const WebHistoryItem&);
+
+#if WEBKIT_IMPLEMENTATION
+    WebHistoryItem(const WTF::PassRefPtr<WebCore::HistoryItem>&);
+    WebHistoryItem& operator=(const WTF::PassRefPtr<WebCore::HistoryItem>&);
+    operator WTF::PassRefPtr<WebCore::HistoryItem>() const;
+#endif
+
+private:
+    void assign(WebHistoryItemPrivate*);
+    void ensureMutable();
+    WebHistoryItemPrivate* m_private;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebImage.h b/WebKit/chromium/public/WebImage.h
new file mode 100644
index 0000000..a7b6f8c
--- /dev/null
+++ b/WebKit/chromium/public/WebImage.h
@@ -0,0 +1,126 @@
+/*
+ * 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 WebImage_h
+#define WebImage_h
+
+#include "WebCommon.h"
+
+#if WEBKIT_USING_SKIA
+#include <SkBitmap.h>
+#elif WEBKIT_USING_CG
+typedef struct CGImage* CGImageRef;
+#endif
+
+#if WEBKIT_IMPLEMENTATION
+namespace WebCore { class Image; }
+namespace WTF { template <typename T> class PassRefPtr; }
+#endif
+
+namespace WebKit {
+
+class WebData;
+struct WebSize;
+
+// A container for an ARGB bitmap.
+class WebImage {
+public:
+    ~WebImage() { reset(); }
+
+    WebImage() { init(); }
+    WebImage(const WebImage& image)
+    {
+        init();
+        assign(image);
+    }
+
+    WebImage& operator=(const WebImage& image)
+    {
+        assign(image);
+        return *this;
+    }
+
+    // Decodes the given image data.  If the image has multiple frames,
+    // then the frame whose size is desiredSize is returned.  Otherwise,
+    // the first frame is returned.
+    WEBKIT_API static WebImage fromData(const WebData&, const WebSize& desiredSize);
+
+    WEBKIT_API void reset();
+    WEBKIT_API void assign(const WebImage&);
+
+    WEBKIT_API bool isNull() const;
+    WEBKIT_API WebSize size() const;
+
+#if WEBKIT_IMPLEMENTATION
+    WebImage(const WTF::PassRefPtr<WebCore::Image>&);
+    WebImage& operator=(const WTF::PassRefPtr<WebCore::Image>&);
+#endif
+
+#if WEBKIT_USING_SKIA
+    WebImage(const SkBitmap& bitmap) : m_bitmap(bitmap) { }
+
+    WebImage& operator=(const SkBitmap& bitmap)
+    {
+        m_bitmap = bitmap;
+        return *this;
+    }
+
+    SkBitmap& getSkBitmap() { return m_bitmap; }
+    const SkBitmap& getSkBitmap() const { return m_bitmap; }
+
+private:
+    void init() { }
+    SkBitmap m_bitmap;
+
+#elif WEBKIT_USING_CG
+    WebImage(CGImageRef imageRef)
+    {
+        init();
+        assign(imageRef);
+    }
+
+    WebImage& operator=(CGImageRef imageRef)
+    {
+        assign(imageRef);
+        return *this;
+    }
+
+    CGImageRef getCGImageRef() const { return m_imageRef; }
+
+private:
+    void init() { m_imageRef = 0; }
+    void assign(CGImageRef);
+    CGImageRef m_imageRef;
+#endif
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebInputEvent.h b/WebKit/chromium/public/WebInputEvent.h
new file mode 100644
index 0000000..983aa2a
--- /dev/null
+++ b/WebKit/chromium/public/WebInputEvent.h
@@ -0,0 +1,260 @@
+/*
+ * 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 WebInputEvent_h
+#define WebInputEvent_h
+
+#include "WebCommon.h"
+
+#include <string.h>
+
+namespace WebKit {
+
+// The classes defined in this file are intended to be used with
+// WebWidget's handleInputEvent method.  These event types are cross-
+// platform and correspond closely to WebCore's Platform*Event classes.
+//
+// WARNING! These classes must remain PODs (plain old data).  They are
+// intended to be "serializable" by copying their raw bytes, so they must
+// not contain any non-bit-copyable member variables!
+
+// WebInputEvent --------------------------------------------------------------
+
+class WebInputEvent {
+public:
+    WebInputEvent(unsigned sizeParam = sizeof(WebInputEvent))
+        : size(sizeParam)
+        , type(Undefined)
+        , modifiers(0)
+        , timeStampSeconds(0.0) { }
+
+    // When we use an input method (or an input method editor), we receive
+    // two events for a keypress. The former event is a keydown, which
+    // provides a keycode, and the latter is a textinput, which provides
+    // a character processed by an input method. (The mapping from a
+    // keycode to a character code is not trivial for non-English
+    // keyboards.)
+    // To support input methods, Safari sends keydown events to WebKit for
+    // filtering. WebKit sends filtered keydown events back to Safari,
+    // which sends them to input methods.
+    // Unfortunately, it is hard to apply this design to Chrome because of
+    // our multiprocess architecture. An input method is running in a
+    // browser process. On the other hand, WebKit is running in a renderer
+    // process. So, this design results in increasing IPC messages.
+    // To support input methods without increasing IPC messages, Chrome
+    // handles keyboard events in a browser process and send asynchronous
+    // input events (to be translated to DOM events) to a renderer
+    // process.
+    // This design is mostly the same as the one of Windows and Mac Carbon.
+    // So, for what it's worth, our Linux and Mac front-ends emulate our
+    // Windows front-end. To emulate our Windows front-end, we can share
+    // our back-end code among Windows, Linux, and Mac.
+    // TODO(hbono): Issue 18064: remove the KeyDown type since it isn't
+    // used in Chrome any longer.
+
+    enum Type {
+        Undefined = -1,
+
+        // WebMouseEvent
+        MouseDown,
+        MouseUp,
+        MouseMove,
+        MouseEnter,
+        MouseLeave,
+
+        // WebMouseWheelEvent
+        MouseWheel,
+
+        // WebKeyboardEvent
+        RawKeyDown,
+        KeyDown,
+        KeyUp,
+        Char
+    };
+
+    enum Modifiers {
+        // modifiers for all events:
+        ShiftKey         = 1 << 0,
+        ControlKey       = 1 << 1,
+        AltKey           = 1 << 2,
+        MetaKey          = 1 << 3,
+
+        // modifiers for keyboard events:
+        IsKeyPad         = 1 << 4,
+        IsAutoRepeat     = 1 << 5,
+
+        // modifiers for mouse events:
+        LeftButtonDown   = 1 << 6,
+        MiddleButtonDown = 1 << 7,
+        RightButtonDown  = 1 << 8,
+    };
+
+    unsigned size;   // The size of this structure, for serialization.
+    Type type;
+    int modifiers;
+    double timeStampSeconds;   // Seconds since epoch.
+
+    // Returns true if the WebInputEvent |type| is a keyboard event.
+    static bool isKeyboardEventType(int type)
+    {
+        return type == RawKeyDown
+            || type == KeyDown
+            || type == KeyUp
+            || type == Char;
+    }
+};
+
+// WebKeyboardEvent -----------------------------------------------------------
+
+class WebKeyboardEvent : public WebInputEvent {
+public:
+    // Caps on string lengths so we can make them static arrays and keep
+    // them PODs.
+    static const size_t textLengthCap = 4;
+
+    // http://www.w3.org/TR/DOM-Level-3-Events/keyset.html lists the
+    // identifiers.  The longest is 18 characters, so we round up to the
+    // next multiple of 4.
+    static const size_t keyIdentifierLengthCap = 20;
+
+    // |windowsKeyCode| is the Windows key code associated with this key
+    // event.  Sometimes it's direct from the event (i.e. on Windows),
+    // sometimes it's via a mapping function.  If you want a list, see
+    // WebCore/platform/chromium/KeyboardCodes* .
+    int windowsKeyCode;
+
+    // The actual key code genenerated by the platform.  The DOM spec runs
+    // on Windows-equivalent codes (thus |windowsKeyCode| above) but it
+    // doesn't hurt to have this one around.
+    int nativeKeyCode;
+
+    // |text| is the text generated by this keystroke.  |unmodifiedText| is
+    // |text|, but unmodified by an concurrently-held modifiers (except
+    // shift).  This is useful for working out shortcut keys.  Linux and
+    // Windows guarantee one character per event.  The Mac does not, but in
+    // reality that's all it ever gives.  We're generous, and cap it a bit
+    // longer.
+    WebUChar text[textLengthCap];
+    WebUChar unmodifiedText[textLengthCap];
+
+    // This is a string identifying the key pressed.
+    char keyIdentifier[keyIdentifierLengthCap];
+
+    // This identifies whether this event was tagged by the system as being
+    // a "system key" event (see
+    // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for
+    // details).  Other platforms don't have this concept, but it's just
+    // easier to leave it always false than ifdef.
+    // int is used instead of bool to ensure the size of this structure is
+    // strictly aligned to a factor of 4 bytes, otherwise memory check tools
+    // like valgrind may complain about uninitialized memory usage when
+    // transfering it over the wire.
+    int isSystemKey;
+
+    WebKeyboardEvent(unsigned sizeParam = sizeof(WebKeyboardEvent))
+        : WebInputEvent(sizeParam)
+        , windowsKeyCode(0)
+        , nativeKeyCode(0)
+        , isSystemKey(false)
+    {
+        memset(&text, 0, sizeof(text));
+        memset(&unmodifiedText, 0, sizeof(unmodifiedText));
+        memset(&keyIdentifier, 0, sizeof(keyIdentifier));
+    }
+
+    // Sets keyIdentifier based on the value of windowsKeyCode.  This is
+    // handy for generating synthetic keyboard events.
+    WEBKIT_API void setKeyIdentifierFromWindowsKeyCode();
+};
+
+// WebMouseEvent --------------------------------------------------------------
+
+class WebMouseEvent : public WebInputEvent {
+public:
+    // These values defined for WebCore::MouseButton
+    enum Button {
+        ButtonNone = -1,
+        ButtonLeft,
+        ButtonMiddle,
+        ButtonRight
+    };
+
+    Button button;
+    int x;
+    int y;
+    int windowX;
+    int windowY;
+    int globalX;
+    int globalY;
+    int clickCount;
+
+    WebMouseEvent(unsigned sizeParam = sizeof(WebMouseEvent))
+        : WebInputEvent(sizeParam)
+        , button(ButtonNone)
+        , x(0)
+        , y(0)
+        , windowX(0)
+        , windowY(0)
+        , globalX(0)
+        , globalY(0)
+        , clickCount(0)
+    {
+    }
+};
+
+// WebMouseWheelEvent ---------------------------------------------------------
+
+class WebMouseWheelEvent : public WebMouseEvent {
+public:
+    float deltaX;
+    float deltaY;
+    float wheelTicksX;
+    float wheelTicksY;
+
+    // int is used instead of bool to ensure the size of this structure is
+    // strictly aligned to a factor of 4 bytes, otherwise memory check tools
+    // like valgrind may complain about uninitialized memory usage when
+    // transfering it over the wire.
+    int scrollByPage;
+
+    WebMouseWheelEvent(unsigned sizeParam = sizeof(WebMouseWheelEvent))
+        : WebMouseEvent(sizeParam)
+        , deltaX(0.0f)
+        , deltaY(0.0f)
+        , wheelTicksX(0.0f)
+        , wheelTicksY(0.0f)
+        , scrollByPage(false)
+    {
+    }
+};
+
+} // namespace WebKit
+
+#endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list