Changeset 127988 in webkit
- Timestamp:
- Sep 9, 2012 10:22:58 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r127986 r127988 1 2012-09-09 Pierre Rossi <pierre.rossi@gmail.com> 2 3 [WK2] expose element rect for color input type 4 https://bugs.webkit.org/show_bug.cgi?id=91664 5 6 Reviewed by Simon Hausmann. 7 8 In the same way we do for select elements already. This allows placing the picker 9 in a sensible location. 10 11 * UIProcess/API/efl/PageClientImpl.cpp: Update the function's signature. 12 (WebKit::PageClientImpl::createColorChooserProxy): Ditto. 13 * UIProcess/API/efl/PageClientImpl.h: Ditto. 14 (PageClientImpl): 15 * UIProcess/API/gtk/PageClientImpl.cpp: 16 (WebKit::PageClientImpl::createColorChooserProxy): Ditto. 17 * UIProcess/API/gtk/PageClientImpl.h: Ditto. 18 (PageClientImpl): 19 * UIProcess/API/mac/PageClientImpl.h: Ditto. 20 (PageClientImpl): 21 * UIProcess/API/mac/PageClientImpl.mm: 22 (WebKit::PageClientImpl::createColorChooserProxy): Ditto. 23 * UIProcess/API/qt/raw/qrawwebview.cpp: 24 (QRawWebViewPrivate::createColorChooserProxy): Ditto. 25 * UIProcess/API/qt/raw/qrawwebview_p_p.h: Ditto. 26 (QRawWebViewPrivate): 27 * UIProcess/PageClient.h: Ditto. 28 (PageClient): 29 * UIProcess/WebPageProxy.cpp: 30 (WebKit::WebPageProxy::showColorChooser): Compute the rect mapped to the current view's transform. 31 * UIProcess/WebPageProxy.h: 32 (WebPageProxy): 33 * UIProcess/WebPageProxy.messages.in: 34 * UIProcess/qt/QtPageClient.cpp: 35 (WebKit::QtPageClient::createColorChooserProxy): 36 * UIProcess/qt/QtPageClient.h: 37 (QtPageClient): 38 * UIProcess/qt/WebColorChooserProxyQt.cpp: 39 (ColorChooserContextObject): 40 (WebKit::ColorChooserContextObject::ColorChooserContextObject): 41 (WebKit::ColorChooserContextObject::elementRect): 42 (WebKit::ColorChooserContextObject::accept): 43 (WebKit::WebColorChooserProxyQt::WebColorChooserProxyQt): 44 * UIProcess/qt/WebColorChooserProxyQt.h: 45 (WebKit::WebColorChooserProxyQt::create): 46 (WebColorChooserProxyQt): 47 * UIProcess/win/WebView.cpp: 48 (WebKit::WebView::createColorChooserProxy): Update the function's signature. 49 * UIProcess/win/WebView.h: 50 (WebView): Ditto. 51 * WebProcess/WebCoreSupport/WebColorChooser.cpp: 52 (WebKit::WebColorChooser::WebColorChooser): 53 1 54 2012-09-09 Simon Hausmann <simon.hausmann@nokia.com> 2 55 -
trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
r126866 r127988 209 209 210 210 #if ENABLE(INPUT_TYPE_COLOR) 211 PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color& )211 PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&) 212 212 { 213 213 notImplemented(); -
trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h
r126844 r127988 87 87 88 88 #if ENABLE(INPUT_TYPE_COLOR) 89 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor );89 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&); 90 90 #endif 91 91 -
trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp
r124087 r127988 234 234 235 235 #if ENABLE(INPUT_TYPE_COLOR) 236 PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color& )236 PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&) 237 237 { 238 238 notImplemented(); -
trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h
r126958 r127988 83 83 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*); 84 84 #if ENABLE(INPUT_TYPE_COLOR) 85 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& intialColor );85 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&); 86 86 #endif 87 87 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate); -
trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
r126958 r127988 98 98 99 99 #if ENABLE(INPUT_TYPE_COLOR) 100 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor );100 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&); 101 101 #endif 102 102 -
trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
r122400 r127988 367 367 368 368 #if ENABLE(INPUT_TYPE_COLOR) 369 PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color& )369 PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&) 370 370 { 371 371 notImplemented(); -
trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
r127559 r127988 186 186 187 187 #if ENABLE(INPUT_TYPE_COLOR) 188 PassRefPtr<WebKit::WebColorChooserProxy> QRawWebViewPrivate::createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor )188 PassRefPtr<WebKit::WebColorChooserProxy> QRawWebViewPrivate::createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&) 189 189 { 190 190 notImplemented(); -
trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h
r121620 r127988 88 88 89 89 #if ENABLE(INPUT_TYPE_COLOR) 90 virtual PassRefPtr<WebKit::WebColorChooserProxy> createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor );90 virtual PassRefPtr<WebKit::WebColorChooserProxy> createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&); 91 91 #endif 92 92 -
trunk/Source/WebKit2/UIProcess/PageClient.h
r124989 r127988 181 181 182 182 #if ENABLE(INPUT_TYPE_COLOR) 183 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor ) = 0;183 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) = 0; 184 184 #endif 185 185 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r127968 r127988 2708 2708 2709 2709 #if ENABLE(INPUT_TYPE_COLOR) 2710 void WebPageProxy::showColorChooser(const WebCore::Color& initialColor )2710 void WebPageProxy::showColorChooser(const WebCore::Color& initialColor, const IntRect& elementRect) 2711 2711 { 2712 2712 ASSERT(!m_colorChooser); 2713 2713 2714 m_colorChooser = m_pageClient->createColorChooserProxy(this, initialColor );2714 m_colorChooser = m_pageClient->createColorChooserProxy(this, initialColor, elementRect); 2715 2715 } 2716 2716 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r127525 r127988 850 850 851 851 #if ENABLE(INPUT_TYPE_COLOR) 852 void showColorChooser(const WebCore::Color& initialColor );852 void showColorChooser(const WebCore::Color& initialColor, const WebCore::IntRect&); 853 853 void setColorChooserColor(const WebCore::Color&); 854 854 void endColorChooser(); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r124989 r127988 89 89 90 90 #if ENABLE(INPUT_TYPE_COLOR) 91 ShowColorChooser(WebCore::Color initialColor );91 ShowColorChooser(WebCore::Color initialColor, WebCore::IntRect elementRect); 92 92 SetColorChooserColor(WebCore::Color color); 93 93 EndColorChooser(); -
trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp
r123476 r127988 210 210 211 211 #if ENABLE(INPUT_TYPE_COLOR) 212 PassRefPtr<WebColorChooserProxy> QtPageClient::createColorChooserProxy(WebPageProxy* webPageProxy, const WebCore::Color& initialColor )213 { 214 return WebColorChooserProxyQt::create(webPageProxy, m_webView, initialColor );212 PassRefPtr<WebColorChooserProxy> QtPageClient::createColorChooserProxy(WebPageProxy* webPageProxy, const WebCore::Color& initialColor, const WebCore::IntRect& elementRect) 213 { 214 return WebColorChooserProxyQt::create(webPageProxy, m_webView, initialColor, elementRect); 215 215 } 216 216 #endif -
trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h
r120890 r127988 88 88 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*); 89 89 #if ENABLE(INPUT_TYPE_COLOR) 90 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& in tialColor);90 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&); 91 91 #endif 92 92 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) { } -
trunk/Source/WebKit2/UIProcess/qt/WebColorChooserProxyQt.cpp
r124758 r127988 35 35 Q_OBJECT 36 36 Q_PROPERTY(QColor currentColor READ currentColor CONSTANT FINAL) 37 Q_PROPERTY(QRectF elementRect READ elementRect CONSTANT FINAL) 37 38 38 39 public: 39 ColorChooserContextObject(const QColor& color )40 ColorChooserContextObject(const QColor& color, const QRectF& rect) 40 41 : m_currentColor(color) 42 , m_rect(rect) 41 43 { 42 44 } 43 45 44 46 QColor currentColor() const { return m_currentColor; } 47 QRectF elementRect() const { return m_rect; } 45 48 46 Q_INVOKABLE void accept(const QColor& color) { emit accepted(color); } ;49 Q_INVOKABLE void accept(const QColor& color) { emit accepted(color); } 47 50 Q_INVOKABLE void reject() { emit rejected(); } 48 51 … … 53 56 private: 54 57 QColor m_currentColor; 58 QRectF m_rect; 55 59 }; 56 60 57 WebColorChooserProxyQt::WebColorChooserProxyQt(WebColorChooserProxy::Client* client, QQuickWebView* webView, const Color& initialColor )61 WebColorChooserProxyQt::WebColorChooserProxyQt(WebColorChooserProxy::Client* client, QQuickWebView* webView, const Color& initialColor, const IntRect& elementRect) 58 62 : WebColorChooserProxy(client) 59 63 , m_webView(webView) 60 64 { 61 ColorChooserContextObject* contextObject = new ColorChooserContextObject(initialColor); 65 const QRectF mappedRect= m_webView->mapRectFromWebContent(QRect(elementRect)); 66 ColorChooserContextObject* contextObject = new ColorChooserContextObject(initialColor, mappedRect); 62 67 createItem(contextObject); 63 68 } -
trunk/Source/WebKit2/UIProcess/qt/WebColorChooserProxyQt.h
r123456 r127988 22 22 #define WebColorChooserProxyQt_h 23 23 24 #include "IntRect.h" 24 25 #include "WebColorChooserProxy.h" 25 26 #include <QtCore/QObject> … … 44 45 45 46 public: 46 static PassRefPtr<WebColorChooserProxy> create(WebColorChooserProxy::Client* client, QQuickWebView* webView, const WebCore::Color& initialColor )47 static PassRefPtr<WebColorChooserProxy> create(WebColorChooserProxy::Client* client, QQuickWebView* webView, const WebCore::Color& initialColor, const WebCore::IntRect& elementRect) 47 48 { 48 return adoptRef(new WebColorChooserProxyQt(client, webView, initialColor ));49 return adoptRef(new WebColorChooserProxyQt(client, webView, initialColor, elementRect)); 49 50 } 50 51 ~WebColorChooserProxyQt(); … … 59 60 60 61 private: 61 WebColorChooserProxyQt(WebColorChooserProxy::Client*, QQuickWebView*, const WebCore::Color& );62 WebColorChooserProxyQt(WebColorChooserProxy::Client*, QQuickWebView*, const WebCore::Color&, const WebCore::IntRect&); 62 63 63 64 void createItem(QObject*); -
trunk/Source/WebKit2/UIProcess/win/WebView.cpp
r127732 r127988 1432 1432 1433 1433 #if ENABLE(INPUT_TYPE_COLOR) 1434 PassRefPtr<WebColorChooserProxy> WebView::createColorChooserProxy(WebPageProxy*, const WebCore::Color& )1434 PassRefPtr<WebColorChooserProxy> WebView::createColorChooserProxy(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&) 1435 1435 { 1436 1436 notImplemented(); -
trunk/Source/WebKit2/UIProcess/win/WebView.h
r120890 r127988 200 200 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*); 201 201 #if ENABLE(INPUT_TYPE_COLOR) 202 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& intialColor );202 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&); 203 203 #endif 204 204 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate); -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.cpp
r120890 r127988 44 44 { 45 45 m_page->setActiveColorChooser(this); 46 WebProcess::shared().connection()->send(Messages::WebPageProxy::ShowColorChooser(initialColor ), m_page->pageID());46 WebProcess::shared().connection()->send(Messages::WebPageProxy::ShowColorChooser(initialColor, client->elementRectRelativeToRootView()), m_page->pageID()); 47 47 } 48 48 -
trunk/Tools/ChangeLog
r127966 r127988 1 2012-09-09 Pierre Rossi <pierre.rossi@gmail.com> 2 3 [WK2] expose element rect for color input type 4 https://bugs.webkit.org/show_bug.cgi?id=91664 5 6 Reviewed by Simon Hausmann. 7 8 Update the QML logic in MiniBrowser to take advantage of this. 9 The picker size is now hardcoded and we try to place it below the 10 input element if possible. 11 12 * MiniBrowser/qt/qml/ColorChooser.qml: 13 1 14 2012-09-08 Christophe Dumez <christophe.dumez@intel.com> 2 15 -
trunk/Tools/MiniBrowser/qt/qml/ColorChooser.qml
r120921 r127988 39 39 opacity: 0.8 40 40 radius: 5 41 width: parent.width / 4 42 height: parent.height / 4 43 anchors.centerIn: parent 41 width: 200 42 height: 200 43 x: (model.elementRect.x + width > parent.width) ? parent.width - width : model.elementRect.x 44 y: (model.elementRect.y + model.elementRect.height + height < parent.height ) ? model.elementRect.y + model.elementRect.height 45 : model.elementRect.y - height; 44 46 45 47 Rectangle {
Note: See TracChangeset
for help on using the changeset viewer.