Title: [123458] trunk/Source/WebKit/qt
Revision
123458
Author
pierre.ro...@gmail.com
Date
2012-07-24 04:48:20 -0700 (Tue, 24 Jul 2012)

Log Message

[Qt][WK1] color input type support
https://bugs.webkit.org/show_bug.cgi?id=91998

Reviewed by Simon Hausmann.

Using QColorDialog. This is private for now, but
it could be exposed via a virtual function in
QWebPage at a later point in a Qt 5 minor release
if there are requests for that.

* Api/qwebpage.cpp:
(QWebPagePrivate::colorSelectionRequested):
* Api/qwebpage_p.h:
(QWebPagePrivate):
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::createColorChooser):

Modified Paths

Diff

Modified: trunk/Source/WebKit/qt/Api/qwebpage.cpp (123457 => 123458)


--- trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-07-24 11:37:15 UTC (rev 123457)
+++ trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-07-24 11:48:20 UTC (rev 123458)
@@ -122,6 +122,7 @@
 #include <QApplication>
 #include <QBasicTimer>
 #include <QBitArray>
+#include <QColorDialog>
 #include <QDebug>
 #include <QDesktopWidget>
 #include <QDragEnterEvent>
@@ -2443,6 +2444,19 @@
         editor->command(command).execute();
 }
 
+
+QColor QWebPagePrivate::colorSelectionRequested(const QColor &selectedColor)
+{
+    QColor ret = selectedColor;
+#ifndef QT_NO_COLORDIALOG
+    QWidget* parent = (client) ? client->ownerWidget() : 0;
+    ret = QColorDialog::getColor(selectedColor, parent);
+    if (!ret.isValid())
+        ret = selectedColor;
+#endif
+    return ret;
+}
+
 QSize QWebPage::viewportSize() const
 {
     if (d->mainFrame && d->mainFrame.data()->d->frame->view())

Modified: trunk/Source/WebKit/qt/Api/qwebpage_p.h (123457 => 123458)


--- trunk/Source/WebKit/qt/Api/qwebpage_p.h	2012-07-24 11:37:15 UTC (rev 123457)
+++ trunk/Source/WebKit/qt/Api/qwebpage_p.h	2012-07-24 11:48:20 UTC (rev 123458)
@@ -94,6 +94,8 @@
     void updateNavigationActions();
     void updateEditorActions();
 
+    QColor colorSelectionRequested(const QColor& selectedColor);
+
     void timerEvent(QTimerEvent*);
 
     template<class T> void mouseMoveEvent(T*);

Modified: trunk/Source/WebKit/qt/ChangeLog (123457 => 123458)


--- trunk/Source/WebKit/qt/ChangeLog	2012-07-24 11:37:15 UTC (rev 123457)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-07-24 11:48:20 UTC (rev 123458)
@@ -1,3 +1,22 @@
+2012-07-24  Pierre Rossi  <pierre.ro...@gmail.com>
+
+        [Qt][WK1] color input type support
+        https://bugs.webkit.org/show_bug.cgi?id=91998
+
+        Reviewed by Simon Hausmann.
+
+        Using QColorDialog. This is private for now, but
+        it could be exposed via a virtual function in
+        QWebPage at a later point in a Qt 5 minor release
+        if there are requests for that.
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::colorSelectionRequested):
+        * Api/qwebpage_p.h:
+        (QWebPagePrivate):
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::createColorChooser):
+
 2012-07-23  Oswald Buddenhagen  <oswald.buddenha...@nokia.com>
 
         [Qt] Fix compilation against namespaced Qt

Modified: trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp (123457 => 123458)


--- trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp	2012-07-24 11:37:15 UTC (rev 123457)
+++ trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp	2012-07-24 11:48:20 UTC (rev 123458)
@@ -32,6 +32,7 @@
 
 #include "ApplicationCacheStorage.h"
 #include "ColorChooser.h"
+#include "ColorChooserClient.h"
 #include "DatabaseTracker.h"
 #include "Document.h"
 #include "FileChooser.h"
@@ -559,9 +560,11 @@
 }
 
 #if ENABLE(INPUT_TYPE_COLOR)
-PassOwnPtr<ColorChooser> ChromeClientQt::createColorChooser(ColorChooserClient*, const Color&)
+PassOwnPtr<ColorChooser> ChromeClientQt::createColorChooser(ColorChooserClient* client, const Color& color)
 {
-    notImplemented();
+    const QColor selectedColor = m_webPage->d->colorSelectionRequested(QColor(color));
+    client->didChooseColor(selectedColor);
+    client->didEndChooser();
     return nullptr;
 }
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to