Michael Brasser <michael.brasser@trolltech.com>
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2008 09:55:46 +0000 (09:55 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2008 09:55:46 +0000 (09:55 +0000)
Rendering fixes for Qtopia.

Make the focus ring work with line breaks (until we have QPainterPath::simplify) and
call QStyle with better arguments when painting themed elements.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29735 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/graphics/qt/GraphicsContextQt.cpp
WebCore/platform/qt/RenderThemeQt.cpp

index 03a347d..8860f2a 100644 (file)
@@ -1,3 +1,18 @@
+2008-01-23  Michael Brasser  <michael.brasser@trolltech.com>
+
+        Reviewed by Simon.
+
+        Rendering fixes for Qtopia.
+
+        Make the focus ring work with line breaks (until we have QPainterPath::simplify) and
+        call QStyle with better arguments when painting themed elements.
+
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::drawFocusRing):
+        * platform/qt/RenderThemeQt.cpp:
+        (WebCore::RenderThemeQt::paintButton):
+        (WebCore::RenderThemeQt::applyTheme):
+
 2008-01-23  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
 
         Reviewed by Simon.
index 4dee681..b23bf0e 100644 (file)
@@ -539,9 +539,6 @@ void GraphicsContext::drawFocusRing(const Color& color)
     if (rects.size() == 0)
         return;
 
-    QPainterPath path;
-    for (int i = 0; i < rectCount; ++i)
-        path.addRect(QRectF(rects[i]));
     QPainter *p = m_data->p();
 
     const QPen oldPen = p->pen();
@@ -554,11 +551,15 @@ void GraphicsContext::drawFocusRing(const Color& color)
     p->setPen(nPen);
 #if 0
     // FIXME How do we do a bounding outline with Qt?
+    QPainterPath path;
+    for (int i = 0; i < rectCount; ++i)
+        path.addRect(QRectF(rects[i]));
     QPainterPathStroker stroker;
     QPainterPath newPath = stroker.createStroke(path);
     p->strokePath(newPath, nPen);
 #else
-    p->drawRect(path.boundingRect());
+    for (int i = 0; i < rectCount; ++i)
+        p->drawRect(QRectF(rects[i]));
 #endif
     p->setPen(oldPen);
     p->setBrush(oldBrush);
index 839c22f..dbf080f 100644 (file)
@@ -26,7 +26,9 @@
 
 #include "config.h"
 
+#include "qwebpage.h"
 #include "RenderThemeQt.h"
+#include "ChromeClientQt.h"
 #include "NotImplemented.h"
 
 #include <QApplication>
@@ -40,6 +42,7 @@
 
 #include "Color.h"
 #include "Document.h"
+#include "Page.h"
 #include "Font.h"
 #include "RenderTheme.h"
 #include "GraphicsContext.h"
@@ -238,9 +241,9 @@ bool RenderThemeQt::paintButton(RenderObject* o, const RenderObject::PaintInfo&
     if(appearance == PushButtonAppearance || appearance == ButtonAppearance)
         style->drawControl(QStyle::CE_PushButton, &option, painter);
     else if(appearance == RadioAppearance)
-        style->drawControl(QStyle::CE_RadioButton, &option, painter);
+        style->drawPrimitive(QStyle::PE_IndicatorRadioButton, &option, painter, widget);
     else if(appearance == CheckboxAppearance)
-        style->drawControl(QStyle::CE_CheckBox, &option, painter);
+        style->drawPrimitive(QStyle::PE_IndicatorCheckBox, &option, painter, widget);
 
     return false;
 }
@@ -488,6 +491,14 @@ EAppearance RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con
     if(result == RadioAppearance || result == CheckboxAppearance)
         option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off);
 
+    // If the webview has a custom palette, use it
+    Page* page = o->document()->page();
+    if (page) {
+        QWidget* view = static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage->view();
+        if (view)
+            option.palette = view->palette();
+    }
+
     return result;
 }