[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d

eric at webkit.org eric at webkit.org
Thu Dec 3 13:30:04 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 45427aa07c71d42881276719e489673a44882e37
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 9 21:47:35 2009 +0000

    2009-11-09  Yaar Schnitman  <yaar at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            Upstreaming the Chromium WebKit API: WebString and other basic objects.
    
            https://bugs.webkit.org/show_bug.cgi?id=28394
    
            * public/WebRange.h: Added.
            (WebKit::WebRange::~WebRange):
            (WebKit::WebRange::WebRange):
            (WebKit::WebRange::operator=):
            (WebKit::WebRange::isNull):
            * public/WebRect.h: Added.
            (WebKit::WebRect::isEmpty):
            (WebKit::WebRect::WebRect):
            (WebKit::WebRect::operator=):
            (WebKit::WebRect::operator WebCore::IntRect):
            (WebKit::WebRect::operator gfx::Rect):
            (WebKit::operator==):
            (WebKit::operator!=):
            * public/WebSize.h: Added.
            (WebKit::WebSize::isEmpty):
            (WebKit::WebSize::WebSize):
            (WebKit::WebSize::operator=):
            (WebKit::WebSize::operator WebCore::IntSize):
            (WebKit::WebSize::operator gfx::Size):
            (WebKit::operator==):
            (WebKit::operator!=):
            * public/WebString.h: Added.
            (WebKit::WebString::~WebString):
            (WebKit::WebString::WebString):
            (WebKit::WebString::operator=):
            (WebKit::WebString::isEmpty):
            (WebKit::WebString::isNull):
            (WebKit::WebString::operator string16):
            (WebKit::WebString::operator NullableString16):
            (WebKit::WebString::fromUTF8):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50687 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 49e3f32..43958a6 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,5 +1,44 @@
 2009-11-09  Yaar Schnitman  <yaar at chromium.org>
 
+        Reviewed by Dimitri Glazkov.
+
+        Upstreaming the Chromium WebKit API: WebString and other basic objects.
+
+        https://bugs.webkit.org/show_bug.cgi?id=28394
+
+        * public/WebRange.h: Added.
+        (WebKit::WebRange::~WebRange):
+        (WebKit::WebRange::WebRange):
+        (WebKit::WebRange::operator=):
+        (WebKit::WebRange::isNull):
+        * public/WebRect.h: Added.
+        (WebKit::WebRect::isEmpty):
+        (WebKit::WebRect::WebRect):
+        (WebKit::WebRect::operator=):
+        (WebKit::WebRect::operator WebCore::IntRect):
+        (WebKit::WebRect::operator gfx::Rect):
+        (WebKit::operator==):
+        (WebKit::operator!=):
+        * public/WebSize.h: Added.
+        (WebKit::WebSize::isEmpty):
+        (WebKit::WebSize::WebSize):
+        (WebKit::WebSize::operator=):
+        (WebKit::WebSize::operator WebCore::IntSize):
+        (WebKit::WebSize::operator gfx::Size):
+        (WebKit::operator==):
+        (WebKit::operator!=):
+        * public/WebString.h: Added.
+        (WebKit::WebString::~WebString):
+        (WebKit::WebString::WebString):
+        (WebKit::WebString::operator=):
+        (WebKit::WebString::isEmpty):
+        (WebKit::WebString::isNull):
+        (WebKit::WebString::operator string16):
+        (WebKit::WebString::operator NullableString16):
+        (WebKit::WebString::fromUTF8):
+
+2009-11-09  Yaar Schnitman  <yaar at chromium.org>
+
         Reviewed by Eric Seidel.
 
         Upstreaming the Chromium WebKit API: WebText*
diff --git a/WebKit/chromium/public/WebRange.h b/WebKit/chromium/public/WebRange.h
new file mode 100644
index 0000000..89fc8f6
--- /dev/null
+++ b/WebKit/chromium/public/WebRange.h
@@ -0,0 +1,86 @@
+/*
+ * 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 WebRange_h
+#define WebRange_h
+
+#include "WebCommon.h"
+
+#if WEBKIT_IMPLEMENTATION
+namespace WebCore { class Range; }
+namespace WTF { template <typename T> class PassRefPtr; }
+#endif
+
+namespace WebKit {
+
+class WebNode;
+class WebRangePrivate;
+class WebString;
+
+// Provides readonly access to some properties of a DOM range.
+class WebRange {
+public:
+    ~WebRange() { reset(); }
+
+    WebRange() : m_private(0) { }
+    WebRange(const WebRange& r) : m_private(0) { assign(r); }
+    WebRange& operator=(const WebRange& r)
+    {
+        assign(r);
+        return *this;
+    }
+
+    WEBKIT_API void reset();
+    WEBKIT_API void assign(const WebRange&);
+
+    bool isNull() const { return !m_private; }
+
+    WEBKIT_API int startOffset() const;
+    WEBKIT_API int endOffset() const;
+    WEBKIT_API WebNode startContainer(int& exceptionCode) const;
+    WEBKIT_API WebNode endContainer(int& exceptionCode) const;
+
+    WEBKIT_API WebString toHTMLText() const;
+    WEBKIT_API WebString toPlainText() const;
+
+#if WEBKIT_IMPLEMENTATION
+    WebRange(const WTF::PassRefPtr<WebCore::Range>&);
+    WebRange& operator=(const WTF::PassRefPtr<WebCore::Range>&);
+    operator WTF::PassRefPtr<WebCore::Range>() const;
+#endif
+
+private:
+    void assign(WebRangePrivate*);
+    WebRangePrivate* m_private;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebRect.h b/WebKit/chromium/public/WebRect.h
new file mode 100644
index 0000000..ed5a7d1
--- /dev/null
+++ b/WebKit/chromium/public/WebRect.h
@@ -0,0 +1,127 @@
+/*
+ * 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 WebRect_h
+#define WebRect_h
+
+#include "WebCommon.h"
+
+#if WEBKIT_IMPLEMENTATION
+#include "IntRect.h"
+#else
+#include <base/gfx/rect.h>
+#endif
+
+namespace WebKit {
+
+struct WebRect {
+    int x;
+    int y;
+    int width;
+    int height;
+
+    bool isEmpty() const { return width <= 0 || height <= 0; }
+
+    WebRect()
+        : x(0)
+        , y(0)
+        , width(0)
+        , height(0)
+    {
+    }
+
+    WebRect(int x, int y, int width, int height)
+        : x(x)
+        , y(y)
+        , width(width)
+        , height(height)
+    {
+    }
+
+#if WEBKIT_IMPLEMENTATION
+    WebRect(const WebCore::IntRect& r)
+        : x(r.x())
+        , y(r.y())
+        , width(r.width())
+        , height(r.height())
+    {
+    }
+
+    WebRect& operator=(const WebCore::IntRect& r)
+    {
+        x = r.x();
+        y = r.y();
+        width = r.width();
+        height = r.height();
+        return *this;
+    }
+
+    operator WebCore::IntRect() const
+    {
+        return WebCore::IntRect(x, y, width, height);
+    }
+#else
+    WebRect(const gfx::Rect& r)
+        : x(r.x())
+        , y(r.y())
+        , width(r.width())
+        , height(r.height())
+    {
+    }
+
+    WebRect& operator=(const gfx::Rect& r)
+    {
+        x = r.x();
+        y = r.y();
+        width = r.width();
+        height = r.height();
+        return *this;
+    }
+
+    operator gfx::Rect() const
+    {
+        return gfx::Rect(x, y, width, height);
+    }
+#endif
+};
+
+inline bool operator==(const WebRect& a, const WebRect& b)
+{
+    return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height;
+}
+
+inline bool operator!=(const WebRect& a, const WebRect& b)
+{
+    return !(a == b);
+}
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebSize.h b/WebKit/chromium/public/WebSize.h
new file mode 100644
index 0000000..bb88633
--- /dev/null
+++ b/WebKit/chromium/public/WebSize.h
@@ -0,0 +1,113 @@
+/*
+ * 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 WebSize_h
+#define WebSize_h
+
+#include "WebCommon.h"
+
+#if WEBKIT_IMPLEMENTATION
+#include "IntSize.h"
+#else
+#include <base/gfx/rect.h>
+#endif
+
+namespace WebKit {
+
+struct WebSize {
+    int width;
+    int height;
+
+    bool isEmpty() const { return width <= 0 || height <= 0; }
+
+    WebSize()
+        : width(0)
+        , height(0)
+    {
+    }
+
+    WebSize(int width, int height)
+        : width(width)
+        , height(height)
+    {
+    }
+
+#if WEBKIT_IMPLEMENTATION
+    WebSize(const WebCore::IntSize& s)
+        : width(s.width())
+        , height(s.height())
+    {
+    }
+
+    WebSize& operator=(const WebCore::IntSize& s)
+    {
+        width = s.width();
+        height = s.height();
+        return *this;
+    }
+
+    operator WebCore::IntSize() const
+    {
+        return WebCore::IntSize(width, height);
+    }
+#else
+    WebSize(const gfx::Size& s)
+        : width(s.width())
+        , height(s.height())
+    {
+    }
+
+    WebSize& operator=(const gfx::Size& s)
+    {
+        width = s.width();
+        height = s.height();
+        return *this;
+    }
+
+    operator gfx::Size() const
+    {
+        return gfx::Size(width, height);
+    }
+#endif
+};
+
+inline bool operator==(const WebSize& a, const WebSize& b)
+{
+    return a.width == b.width && a.height == b.height;
+}
+
+inline bool operator!=(const WebSize& a, const WebSize& b)
+{
+    return !(a == b);
+}
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebString.h b/WebKit/chromium/public/WebString.h
new file mode 100644
index 0000000..d9b66b2
--- /dev/null
+++ b/WebKit/chromium/public/WebString.h
@@ -0,0 +1,155 @@
+/*
+ * 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 WebString_h
+#define WebString_h
+
+#include "WebCommon.h"
+
+#if WEBKIT_IMPLEMENTATION
+namespace WebCore {
+class String;
+class AtomicString;
+}
+#else
+#include <base/nullable_string16.h>
+#include <base/string16.h>
+#endif
+
+namespace WebKit {
+
+class WebCString;
+class WebStringPrivate;
+
+// A UTF-16 string container.  It is inexpensive to copy a WebString
+// object.
+//
+// WARNING: It is not safe to pass a WebString across threads!!!
+//
+class WebString {
+public:
+    ~WebString() { reset(); }
+
+    WebString() : m_private(0) { }
+
+    WebString(const WebUChar* data, size_t len) : m_private(0)
+    {
+        assign(data, len);
+    }
+
+    WebString(const WebString& s) : m_private(0) { assign(s); }
+
+    WebString& operator=(const WebString& s)
+    {
+        assign(s);
+        return *this;
+    }
+
+    WEBKIT_API void reset();
+    WEBKIT_API void assign(const WebString&);
+    WEBKIT_API void assign(const WebUChar* data, size_t len);
+
+    WEBKIT_API size_t length() const;
+    WEBKIT_API const WebUChar* data() const;
+
+    bool isEmpty() const { return !length(); }
+    bool isNull() const { return !m_private; }
+
+    WEBKIT_API WebCString utf8() const;
+
+    WEBKIT_API static WebString fromUTF8(const char* data, size_t length);
+    WEBKIT_API static WebString fromUTF8(const char* data);
+
+#if WEBKIT_IMPLEMENTATION
+    WebString(const WebCore::String&);
+    WebString& operator=(const WebCore::String&);
+    operator WebCore::String() const;
+
+    WebString(const WebCore::AtomicString&);
+    WebString& operator=(const WebCore::AtomicString&);
+    operator WebCore::AtomicString() const;
+#else
+    WebString(const string16& s) : m_private(0)
+    {
+        assign(s.data(), s.length());
+    }
+
+    WebString& operator=(const string16& s)
+    {
+        assign(s.data(), s.length());
+        return *this;
+    }
+
+    operator string16() const
+    {
+        size_t len = length();
+        return len ? string16(data(), len) : string16();
+    }
+
+    WebString(const NullableString16& s) : m_private(0)
+    {
+        if (s.is_null())
+            assign(0);
+        else
+            assign(s.string().data(), s.string().length());
+    }
+
+    WebString& operator=(const NullableString16& s)
+    {
+        if (s.is_null())
+            assign(0);
+        else
+            assign(s.string().data(), s.string().length());
+        return *this;
+    }
+
+    operator NullableString16() const
+    {
+        if (!m_private)
+            return NullableString16(string16(), true);
+        size_t len = length();
+        return NullableString16(len ? string16(data(), len) : string16(), false);
+    }
+
+    template <class UTF8String>
+    static WebString fromUTF8(const UTF8String& s)
+    {
+        return fromUTF8(s.data(), s.length());
+    }
+#endif
+
+private:
+    void assign(WebStringPrivate*);
+    WebStringPrivate* m_private;
+};
+
+} // namespace WebKit
+
+#endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list