Title: [124394] trunk/Source
Revision
124394
Author
[email protected]
Date
2012-08-01 17:27:06 -0700 (Wed, 01 Aug 2012)

Log Message

[chromium] Make WebKit API support draggable region change update
https://bugs.webkit.org/show_bug.cgi?id=92813

Reviewed by Adam Barth.

Source/Platform:

Add WebDraggableRegion for chromium's usage.

* Platform.gypi:

Source/WebKit/chromium:

Introduce WebDraggableRegion and delegate the draggable region update
call to the new method draggableRegionsChanged in WebViewClient.

* public/WebDocument.h:
(WebDocument):
* public/WebDraggableRegion.h: Added.
(WebKit):
(WebDraggableRegion):
* public/WebViewClient.h:
(WebViewClient):
(WebKit::WebViewClient::draggableRegionsChanged):
* src/ChromeClientImpl.cpp:
(WebKit):
(WebKit::ChromeClientImpl::dashboardRegionsChanged):
* src/ChromeClientImpl.h:
(ChromeClientImpl):
* src/WebDocument.cpp:
(WebKit::WebDocument::draggableRegions):
(WebKit):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (124393 => 124394)


--- trunk/Source/Platform/ChangeLog	2012-08-02 00:26:52 UTC (rev 124393)
+++ trunk/Source/Platform/ChangeLog	2012-08-02 00:27:06 UTC (rev 124394)
@@ -1,3 +1,14 @@
+2012-08-01  Jian Li  <[email protected]>
+
+        [chromium] Make WebKit API support draggable region change update
+        https://bugs.webkit.org/show_bug.cgi?id=92813
+
+        Reviewed by Adam Barth.
+
+        Add WebDraggableRegion for chromium's usage.
+
+        * Platform.gypi:
+
 2012-08-01  Antoine Labour  <[email protected]>
 
         [chromium] factor out the optimization pass in CCRenderSurfaceFilters::apply

Modified: trunk/Source/Platform/Platform.gypi (124393 => 124394)


--- trunk/Source/Platform/Platform.gypi	2012-08-02 00:26:52 UTC (rev 124393)
+++ trunk/Source/Platform/Platform.gypi	2012-08-02 00:27:06 UTC (rev 124394)
@@ -59,6 +59,7 @@
             'chromium/public/WebCookieJar.h',
             'chromium/public/WebData.h',
             'chromium/public/WebDragData.h',
+            'chromium/public/WebDraggableRegion.h',
             'chromium/public/WebExternalTextureLayer.h',
             'chromium/public/WebExternalTextureLayerClient.h',
             'chromium/public/WebFileInfo.h',

Modified: trunk/Source/WebKit/chromium/ChangeLog (124393 => 124394)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-02 00:26:52 UTC (rev 124393)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-02 00:27:06 UTC (rev 124394)
@@ -1,3 +1,30 @@
+2012-08-01  Jian Li  <[email protected]>
+
+        [chromium] Make WebKit API support draggable region change update
+        https://bugs.webkit.org/show_bug.cgi?id=92813
+
+        Reviewed by Adam Barth.
+
+        Introduce WebDraggableRegion and delegate the draggable region update
+        call to the new method draggableRegionsChanged in WebViewClient.
+
+        * public/WebDocument.h:
+        (WebDocument):
+        * public/WebDraggableRegion.h: Added.
+        (WebKit):
+        (WebDraggableRegion):
+        * public/WebViewClient.h:
+        (WebViewClient):
+        (WebKit::WebViewClient::draggableRegionsChanged):
+        * src/ChromeClientImpl.cpp:
+        (WebKit):
+        (WebKit::ChromeClientImpl::dashboardRegionsChanged):
+        * src/ChromeClientImpl.h:
+        (ChromeClientImpl):
+        * src/WebDocument.cpp:
+        (WebKit::WebDocument::draggableRegions):
+        (WebKit):
+
 2012-08-01  Antoine Labour  <[email protected]>
 
         [chromium] factor out the optimization pass in CCRenderSurfaceFilters::apply

Modified: trunk/Source/WebKit/chromium/public/WebDocument.h (124393 => 124394)


--- trunk/Source/WebKit/chromium/public/WebDocument.h	2012-08-02 00:26:52 UTC (rev 124393)
+++ trunk/Source/WebKit/chromium/public/WebDocument.h	2012-08-02 00:27:06 UTC (rev 124394)
@@ -31,6 +31,7 @@
 #ifndef WebDocument_h
 #define WebDocument_h
 
+#include "WebDraggableRegion.h"
 #include "WebNode.h"
 #include "WebSecurityOrigin.h"
 #include "platform/WebReferrerPolicy.h"
@@ -120,6 +121,8 @@
     // WebView.
     WEBKIT_EXPORT void insertUserStyleSheet(const WebString& sourceCode, UserStyleLevel);
 
+    WEBKIT_EXPORT WebVector<WebDraggableRegion> draggableRegions() const;
+
 #if WEBKIT_IMPLEMENTATION
     WebDocument(const WTF::PassRefPtr<WebCore::Document>&);
     WebDocument& operator=(const WTF::PassRefPtr<WebCore::Document>&);

Added: trunk/Source/WebKit/chromium/public/WebDraggableRegion.h (0 => 124394)


--- trunk/Source/WebKit/chromium/public/WebDraggableRegion.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebDraggableRegion.h	2012-08-02 00:27:06 UTC (rev 124394)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * 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 WebDraggableRegion_h
+#define WebDraggableRegion_h
+
+#include "platform/WebCommon.h"
+#include "platform/WebRect.h"
+#include "platform/WebString.h"
+
+namespace WebKit {
+
+struct WebDraggableRegion {
+    WebString label;
+    WebRect bounds;
+    WebRect clip;
+};
+
+} // namespace WebKit
+
+#endif

Modified: trunk/Source/WebKit/chromium/public/WebViewClient.h (124393 => 124394)


--- trunk/Source/WebKit/chromium/public/WebViewClient.h	2012-08-02 00:26:52 UTC (rev 124393)
+++ trunk/Source/WebKit/chromium/public/WebViewClient.h	2012-08-02 00:27:06 UTC (rev 124394)
@@ -381,6 +381,11 @@
     // Cancels any previously scheduled content intents that have not yet launched.
     virtual void cancelScheduledContentIntents() { }
 
+    // Draggable regions ----------------------------------------------------
+
+    // Informs the browser that the draggable regions have been updated.
+    virtual void draggableRegionsChanged() { }
+
 protected:
     ~WebViewClient() { }
 };

Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp (124393 => 124394)


--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-08-02 00:26:52 UTC (rev 124393)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-08-02 00:27:06 UTC (rev 124394)
@@ -1112,6 +1112,15 @@
 }
 #endif
 
+#if ENABLE(WIDGET_REGION)
+void ChromeClientImpl::dashboardRegionsChanged()
+{
+    WebViewClient* client = m_webView->client();
+    if (client)
+        client->draggableRegionsChanged();
+}
+#endif
+
 #if ENABLE(REGISTER_PROTOCOL_HANDLER)
 PassOwnPtr<RegisterProtocolHandlerClientImpl> RegisterProtocolHandlerClientImpl::create(WebViewImpl* webView)
 {

Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.h (124393 => 124394)


--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.h	2012-08-02 00:26:52 UTC (rev 124393)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.h	2012-08-02 00:27:06 UTC (rev 124394)
@@ -136,6 +136,9 @@
         WebCore::Frame*, const WTF::String& databaseName);
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
     virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
+#if ENABLE(WIDGET_REGION)
+    virtual void dashboardRegionsChanged();
+#endif
     virtual bool paintCustomOverhangArea(WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&);
 #if ENABLE(INPUT_TYPE_COLOR)
     virtual PassOwnPtr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient*, const WebCore::Color&) OVERRIDE;

Modified: trunk/Source/WebKit/chromium/src/WebDocument.cpp (124393 => 124394)


--- trunk/Source/WebKit/chromium/src/WebDocument.cpp	2012-08-02 00:26:52 UTC (rev 124393)
+++ trunk/Source/WebKit/chromium/src/WebDocument.cpp	2012-08-02 00:27:06 UTC (rev 124394)
@@ -44,6 +44,7 @@
 #include "HTMLFormElement.h"
 #include "HTMLHeadElement.h"
 #include "NodeList.h"
+#include "RenderObject.h"
 #include "SecurityOrigin.h"
 #include "StyleSheetContents.h"
 #include "WebAccessibilityObject.h"
@@ -242,6 +243,25 @@
         document->axObjectCache()->objectFromAXID(axID));
 }
 
+WebVector<WebDraggableRegion> WebDocument::draggableRegions() const
+{
+    WebVector<WebDraggableRegion> draggableRegions;
+#if ENABLE(WIDGET_REGION)
+    const Document* document = constUnwrap<Document>();
+    if (document->hasDashboardRegions()) {
+        const Vector<DashboardRegionValue>& regions = document->dashboardRegions();
+        draggableRegions = WebVector<WebDraggableRegion>(regions.size());
+        for (size_t i = 0; i < regions.size(); i++) {
+            const DashboardRegionValue& value = regions[i];
+            draggableRegions[i].label = value.label;
+            draggableRegions[i].bounds = WebCore::IntRect(value.bounds);
+            draggableRegions[i].clip = WebCore::IntRect(value.clip);
+        }
+    }
+#endif
+    return draggableRegions;
+}
+
 WebDocument::WebDocument(const PassRefPtr<Document>& elem)
     : WebNode(elem)
 {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to