Title: [127988] trunk
Revision
127988
Author
[email protected]
Date
2012-09-09 10:22:58 -0700 (Sun, 09 Sep 2012)

Log Message

[WK2] expose element rect for color input type
https://bugs.webkit.org/show_bug.cgi?id=91664

Reviewed by Simon Hausmann.

Source/WebKit2:

In the same way we do for select elements already. This allows placing the picker
in a sensible location.

* UIProcess/API/efl/PageClientImpl.cpp: Update the function's signature.
(WebKit::PageClientImpl::createColorChooserProxy): Ditto.
* UIProcess/API/efl/PageClientImpl.h: Ditto.
(PageClientImpl):
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::createColorChooserProxy): Ditto.
* UIProcess/API/gtk/PageClientImpl.h: Ditto.
(PageClientImpl):
* UIProcess/API/mac/PageClientImpl.h: Ditto.
(PageClientImpl):
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::createColorChooserProxy): Ditto.
* UIProcess/API/qt/raw/qrawwebview.cpp:
(QRawWebViewPrivate::createColorChooserProxy): Ditto.
* UIProcess/API/qt/raw/qrawwebview_p_p.h: Ditto.
(QRawWebViewPrivate):
* UIProcess/PageClient.h: Ditto.
(PageClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showColorChooser): Compute the rect mapped to the current view's transform.
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/qt/QtPageClient.cpp:
(WebKit::QtPageClient::createColorChooserProxy):
* UIProcess/qt/QtPageClient.h:
(QtPageClient):
* UIProcess/qt/WebColorChooserProxyQt.cpp:
(ColorChooserContextObject):
(WebKit::ColorChooserContextObject::ColorChooserContextObject):
(WebKit::ColorChooserContextObject::elementRect):
(WebKit::ColorChooserContextObject::accept):
(WebKit::WebColorChooserProxyQt::WebColorChooserProxyQt):
* UIProcess/qt/WebColorChooserProxyQt.h:
(WebKit::WebColorChooserProxyQt::create):
(WebColorChooserProxyQt):
* UIProcess/win/WebView.cpp:
(WebKit::WebView::createColorChooserProxy): Update the function's signature.
* UIProcess/win/WebView.h:
(WebView): Ditto.
* WebProcess/WebCoreSupport/WebColorChooser.cpp:
(WebKit::WebColorChooser::WebColorChooser):

Tools:

Update the QML logic in MiniBrowser to take advantage of this.
The picker size is now hardcoded and we try to place it below the
input element if possible.

* MiniBrowser/qt/qml/ColorChooser.qml:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (127987 => 127988)


--- trunk/Source/WebKit2/ChangeLog	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-09 17:22:58 UTC (rev 127988)
@@ -1,3 +1,56 @@
+2012-09-09  Pierre Rossi  <[email protected]>
+
+        [WK2] expose element rect for color input type
+        https://bugs.webkit.org/show_bug.cgi?id=91664
+
+        Reviewed by Simon Hausmann.
+
+        In the same way we do for select elements already. This allows placing the picker
+        in a sensible location.
+
+        * UIProcess/API/efl/PageClientImpl.cpp: Update the function's signature.
+        (WebKit::PageClientImpl::createColorChooserProxy): Ditto.
+        * UIProcess/API/efl/PageClientImpl.h: Ditto.
+        (PageClientImpl):
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::createColorChooserProxy): Ditto.
+        * UIProcess/API/gtk/PageClientImpl.h: Ditto.
+        (PageClientImpl):
+        * UIProcess/API/mac/PageClientImpl.h: Ditto.
+        (PageClientImpl):
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::createColorChooserProxy): Ditto.
+        * UIProcess/API/qt/raw/qrawwebview.cpp:
+        (QRawWebViewPrivate::createColorChooserProxy): Ditto.
+        * UIProcess/API/qt/raw/qrawwebview_p_p.h: Ditto.
+        (QRawWebViewPrivate):
+        * UIProcess/PageClient.h: Ditto.
+        (PageClient):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::showColorChooser): Compute the rect mapped to the current view's transform.
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/qt/QtPageClient.cpp:
+        (WebKit::QtPageClient::createColorChooserProxy):
+        * UIProcess/qt/QtPageClient.h:
+        (QtPageClient):
+        * UIProcess/qt/WebColorChooserProxyQt.cpp:
+        (ColorChooserContextObject):
+        (WebKit::ColorChooserContextObject::ColorChooserContextObject):
+        (WebKit::ColorChooserContextObject::elementRect):
+        (WebKit::ColorChooserContextObject::accept):
+        (WebKit::WebColorChooserProxyQt::WebColorChooserProxyQt):
+        * UIProcess/qt/WebColorChooserProxyQt.h:
+        (WebKit::WebColorChooserProxyQt::create):
+        (WebColorChooserProxyQt):
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::createColorChooserProxy): Update the function's signature.
+        * UIProcess/win/WebView.h:
+        (WebView): Ditto.
+        * WebProcess/WebCoreSupport/WebColorChooser.cpp:
+        (WebKit::WebColorChooser::WebColorChooser):
+
 2012-09-09  Simon Hausmann  <[email protected]>
 
         [Qt] Add missing files to the WebKit2 build on Windows

Modified: trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp	2012-09-09 17:22:58 UTC (rev 127988)
@@ -208,7 +208,7 @@
 }
 
 #if ENABLE(INPUT_TYPE_COLOR)
-PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&)
+PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&)
 {
     notImplemented();
     return 0;

Modified: trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h	2012-09-09 17:22:58 UTC (rev 127988)
@@ -86,7 +86,7 @@
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor);
+    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&);
 #endif
 
     virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool, bool);

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp	2012-09-09 17:22:58 UTC (rev 127988)
@@ -233,7 +233,7 @@
 }
 
 #if ENABLE(INPUT_TYPE_COLOR)
-PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&)
+PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&)
 {
     notImplemented();
     return 0;

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2012-09-09 17:22:58 UTC (rev 127988)
@@ -82,7 +82,7 @@
     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
 #if ENABLE(INPUT_TYPE_COLOR)
-    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& intialColor);
+    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&);
 #endif
     virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
     virtual void didChangeScrollbarsForMainFrame() const;

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2012-09-09 17:22:58 UTC (rev 127988)
@@ -97,7 +97,7 @@
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor);
+    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&);
 #endif
 
     void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2012-09-09 17:22:58 UTC (rev 127988)
@@ -366,7 +366,7 @@
 }
 
 #if ENABLE(INPUT_TYPE_COLOR)
-PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&)
+PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&,  const WebCore::IntRect&)
 {
     notImplemented();
     return 0;

Modified: trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp	2012-09-09 17:22:58 UTC (rev 127988)
@@ -185,7 +185,7 @@
 }
 
 #if ENABLE(INPUT_TYPE_COLOR)
-PassRefPtr<WebKit::WebColorChooserProxy> QRawWebViewPrivate::createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor)
+PassRefPtr<WebKit::WebColorChooserProxy> QRawWebViewPrivate::createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&)
 {
     notImplemented();
     return PassRefPtr<WebKit::WebColorChooserProxy>();

Modified: trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h	2012-09-09 17:22:58 UTC (rev 127988)
@@ -87,7 +87,7 @@
     virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy* webPageProxy);
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    virtual PassRefPtr<WebKit::WebColorChooserProxy> createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor);
+    virtual PassRefPtr<WebKit::WebColorChooserProxy> createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&);
 #endif
 
     QRawWebViewPrivate(WebKit::WebContext*, WebKit::WebPageGroup*, QRawWebViewClient*);

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2012-09-09 17:22:58 UTC (rev 127988)
@@ -180,7 +180,7 @@
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor) = 0;
+    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) = 0;
 #endif
 
     virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) = 0;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-09-09 17:22:58 UTC (rev 127988)
@@ -2707,11 +2707,11 @@
 #endif
 
 #if ENABLE(INPUT_TYPE_COLOR)
-void WebPageProxy::showColorChooser(const WebCore::Color& initialColor)
+void WebPageProxy::showColorChooser(const WebCore::Color& initialColor, const IntRect& elementRect)
 {
     ASSERT(!m_colorChooser);
 
-    m_colorChooser = m_pageClient->createColorChooserProxy(this, initialColor);
+    m_colorChooser = m_pageClient->createColorChooserProxy(this, initialColor, elementRect);
 }
 
 void WebPageProxy::setColorChooserColor(const WebCore::Color& color)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-09-09 17:22:58 UTC (rev 127988)
@@ -849,7 +849,7 @@
 #endif
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    void showColorChooser(const WebCore::Color& initialColor);
+    void showColorChooser(const WebCore::Color& initialColor, const WebCore::IntRect&);
     void setColorChooserColor(const WebCore::Color&);
     void endColorChooser();
     void didChooseColor(const WebCore::Color&);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-09-09 17:22:58 UTC (rev 127988)
@@ -88,7 +88,7 @@
 #endif
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    ShowColorChooser(WebCore::Color initialColor);
+    ShowColorChooser(WebCore::Color initialColor, WebCore::IntRect elementRect);
     SetColorChooserColor(WebCore::Color color);
     EndColorChooser();
 #endif

Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp	2012-09-09 17:22:58 UTC (rev 127988)
@@ -209,9 +209,9 @@
 }
 
 #if ENABLE(INPUT_TYPE_COLOR)
-PassRefPtr<WebColorChooserProxy> QtPageClient::createColorChooserProxy(WebPageProxy* webPageProxy, const WebCore::Color& initialColor)
+PassRefPtr<WebColorChooserProxy> QtPageClient::createColorChooserProxy(WebPageProxy* webPageProxy, const WebCore::Color& initialColor, const WebCore::IntRect& elementRect)
 {
-    return WebColorChooserProxyQt::create(webPageProxy, m_webView, initialColor);
+    return WebColorChooserProxyQt::create(webPageProxy, m_webView, initialColor, elementRect);
 }
 #endif
 

Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2012-09-09 17:22:58 UTC (rev 127988)
@@ -87,7 +87,7 @@
     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
 #if ENABLE(INPUT_TYPE_COLOR)
-    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& intialColor);
+    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&);
 #endif
     virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) { }
     virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) { }

Modified: trunk/Source/WebKit2/UIProcess/qt/WebColorChooserProxyQt.cpp (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/qt/WebColorChooserProxyQt.cpp	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/qt/WebColorChooserProxyQt.cpp	2012-09-09 17:22:58 UTC (rev 127988)
@@ -34,16 +34,19 @@
 class ColorChooserContextObject : public QObject {
     Q_OBJECT
     Q_PROPERTY(QColor currentColor READ currentColor CONSTANT FINAL)
+    Q_PROPERTY(QRectF elementRect READ elementRect CONSTANT FINAL)
 
 public:
-    ColorChooserContextObject(const QColor& color)
+    ColorChooserContextObject(const QColor& color, const QRectF& rect)
         : m_currentColor(color)
+        , m_rect(rect)
     {
     }
 
     QColor currentColor() const { return m_currentColor; }
+    QRectF elementRect() const { return m_rect; }
 
-    Q_INVOKABLE void accept(const QColor& color) { emit accepted(color); };
+    Q_INVOKABLE void accept(const QColor& color) { emit accepted(color); }
     Q_INVOKABLE void reject() { emit rejected(); }
 
 Q_SIGNALS:
@@ -52,13 +55,15 @@
 
 private:
     QColor m_currentColor;
+    QRectF m_rect;
 };
 
-WebColorChooserProxyQt::WebColorChooserProxyQt(WebColorChooserProxy::Client* client, QQuickWebView* webView, const Color& initialColor)
+WebColorChooserProxyQt::WebColorChooserProxyQt(WebColorChooserProxy::Client* client, QQuickWebView* webView, const Color& initialColor, const IntRect& elementRect)
     : WebColorChooserProxy(client)
     , m_webView(webView)
 {
-    ColorChooserContextObject* contextObject = new ColorChooserContextObject(initialColor);
+    const QRectF mappedRect= m_webView->mapRectFromWebContent(QRect(elementRect));
+    ColorChooserContextObject* contextObject = new ColorChooserContextObject(initialColor, mappedRect);
     createItem(contextObject);
 }
 

Modified: trunk/Source/WebKit2/UIProcess/qt/WebColorChooserProxyQt.h (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/qt/WebColorChooserProxyQt.h	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/qt/WebColorChooserProxyQt.h	2012-09-09 17:22:58 UTC (rev 127988)
@@ -21,6 +21,7 @@
 #ifndef WebColorChooserProxyQt_h
 #define WebColorChooserProxyQt_h
 
+#include "IntRect.h"
 #include "WebColorChooserProxy.h"
 #include <QtCore/QObject>
 #include <wtf/OwnPtr.h>
@@ -43,9 +44,9 @@
     Q_OBJECT
 
 public:
-    static PassRefPtr<WebColorChooserProxy> create(WebColorChooserProxy::Client* client, QQuickWebView* webView, const WebCore::Color& initialColor)
+    static PassRefPtr<WebColorChooserProxy> create(WebColorChooserProxy::Client* client, QQuickWebView* webView, const WebCore::Color& initialColor, const WebCore::IntRect& elementRect)
     {
-        return adoptRef(new WebColorChooserProxyQt(client, webView, initialColor));
+        return adoptRef(new WebColorChooserProxyQt(client, webView, initialColor, elementRect));
     }
     ~WebColorChooserProxyQt();
 
@@ -58,7 +59,7 @@
     void notifyColorSelected(const QColor&);
 
 private:
-    WebColorChooserProxyQt(WebColorChooserProxy::Client*, QQuickWebView*, const WebCore::Color&);
+    WebColorChooserProxyQt(WebColorChooserProxy::Client*, QQuickWebView*, const WebCore::Color&, const WebCore::IntRect&);
 
     void createItem(QObject*);
     void createContext(QQmlComponent*, QObject*);

Modified: trunk/Source/WebKit2/UIProcess/win/WebView.cpp (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/win/WebView.cpp	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/win/WebView.cpp	2012-09-09 17:22:58 UTC (rev 127988)
@@ -1431,7 +1431,7 @@
 }
 
 #if ENABLE(INPUT_TYPE_COLOR)
-PassRefPtr<WebColorChooserProxy> WebView::createColorChooserProxy(WebPageProxy*, const WebCore::Color&)
+PassRefPtr<WebColorChooserProxy> WebView::createColorChooserProxy(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&)
 {
     notImplemented();
     return 0;

Modified: trunk/Source/WebKit2/UIProcess/win/WebView.h (127987 => 127988)


--- trunk/Source/WebKit2/UIProcess/win/WebView.h	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/UIProcess/win/WebView.h	2012-09-09 17:22:58 UTC (rev 127988)
@@ -199,7 +199,7 @@
     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
 #if ENABLE(INPUT_TYPE_COLOR)
-    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& intialColor);
+    virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&);
 #endif
     virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
     virtual void didInstallOrUninstallPageOverlay(bool);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.cpp (127987 => 127988)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.cpp	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.cpp	2012-09-09 17:22:58 UTC (rev 127988)
@@ -43,7 +43,7 @@
     , m_page(page)
 {
     m_page->setActiveColorChooser(this);
-    WebProcess::shared().connection()->send(Messages::WebPageProxy::ShowColorChooser(initialColor), m_page->pageID());
+    WebProcess::shared().connection()->send(Messages::WebPageProxy::ShowColorChooser(initialColor, client->elementRectRelativeToRootView()), m_page->pageID());
 }
 
 WebColorChooser::~WebColorChooser()

Modified: trunk/Tools/ChangeLog (127987 => 127988)


--- trunk/Tools/ChangeLog	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Tools/ChangeLog	2012-09-09 17:22:58 UTC (rev 127988)
@@ -1,3 +1,16 @@
+2012-09-09  Pierre Rossi  <[email protected]>
+
+        [WK2] expose element rect for color input type
+        https://bugs.webkit.org/show_bug.cgi?id=91664
+
+        Reviewed by Simon Hausmann.
+
+        Update the QML logic in MiniBrowser to take advantage of this.
+        The picker size is now hardcoded and we try to place it below the
+        input element if possible.
+
+        * MiniBrowser/qt/qml/ColorChooser.qml:
+
 2012-09-08  Christophe Dumez  <[email protected]>
 
         [WK2] New fast/events/tab-focus-link-in-canvas fails from r126908

Modified: trunk/Tools/MiniBrowser/qt/qml/ColorChooser.qml (127987 => 127988)


--- trunk/Tools/MiniBrowser/qt/qml/ColorChooser.qml	2012-09-09 17:10:21 UTC (rev 127987)
+++ trunk/Tools/MiniBrowser/qt/qml/ColorChooser.qml	2012-09-09 17:22:58 UTC (rev 127988)
@@ -38,9 +38,11 @@
         color: "gainsboro"
         opacity: 0.8
         radius: 5
-        width: parent.width / 4
-        height: parent.height / 4
-        anchors.centerIn: parent
+        width: 200
+        height: 200
+        x: (model.elementRect.x + width > parent.width) ? parent.width - width : model.elementRect.x
+        y: (model.elementRect.y + model.elementRect.height + height < parent.height ) ? model.elementRect.y + model.elementRect.height
+                                                                                      : model.elementRect.y - height;
 
         Rectangle {
             color: "red"
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to