Various Qt related hacks and cleanups to make forms work better
authorstaikos <staikos@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Feb 2007 14:15:14 +0000 (14:15 +0000)
committerstaikos <staikos@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Feb 2007 14:15:14 +0000 (14:15 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@19395 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/qt/PlatformKeyboardEventQt.cpp
WebCore/platform/qt/RenderThemeQt.cpp

index 30325babcd82eefb48c1050b18f5734ce309ae40..273b30fee2c447e9052da5b38ab9cc296084c6b0 100644 (file)
@@ -1,3 +1,19 @@
+2007-02-04  George Staikos  <staikos@kde.org>
+
+        Reviewed by Zack.
+
+        Some Qt hacks and cleanups - makes rendering of forms much better on
+        OS X
+
+        * platform/qt/PlatformKeyboardEventQt.cpp: Add Key_Return/Enter
+        (WebCore::keyIdentifierForQtKeyCode):
+        (WebCore::windowsKeyCodeForKeyEvent):
+        * platform/qt/RenderThemeQt.cpp: Hacks and fix buttons
+        (WebCore::RenderThemeQt::addIntrinsicMargins):
+        (WebCore::RenderThemeQt::setCheckboxSize):
+        (WebCore::RenderThemeQt::supportsFocus):
+        (WebCore::RenderThemeQt::applyTheme):
+
 2007-02-03  Maciej Stachowiak  <mjs@apple.com>
 
         Rubber stamped by Adam.
index 7fdc229a647864ec87ac09830cc5e8cb2fe67fa1..c57ee574bdc3d41e3edfe93fa0fa86786df1805a 100644 (file)
@@ -45,6 +45,7 @@ static String keyIdentifierForQtKeyCode(int keyCode)
             return "Down";
         case Qt::Key_End:
             return "End";
+        case Qt::Key_Return:
         case Qt::Key_Enter:
             return "Enter";
 #if QT_VERSION >= 0x040200
@@ -171,6 +172,7 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode)
             return VK_TAB; // (09) TAB key
         case Qt::Key_Clear:
             return VK_CLEAR; // (0C) CLEAR key
+        case Qt::Key_Enter:
         case Qt::Key_Return:
             return VK_RETURN; //(0D) Return key
         case Qt::Key_Shift:
index 5225c3ac342b417180365584cd5089984536578b..bb8c396cc0c052b167a5d42f32bbb102c3c13d0e 100644 (file)
@@ -131,8 +131,8 @@ void RenderThemeQt::systemFont(int propId, FontDescription& fontDescription) con
 void RenderThemeQt::addIntrinsicMargins(RenderStyle* style) const
 {
     // Cut out the intrinsic margins completely if we end up using a small font size
-    if (style->fontSize() < 11)
-        return;
+    //if (style->fontSize() < 11)
+    //    return;
 
     // Intrinsic margin value.
     const int m = 2;
@@ -174,11 +174,16 @@ void RenderThemeQt::setCheckboxSize(RenderStyle* style) const
     // At different DPI settings on Windows, querying the theme gives you a larger size that accounts for
     // the higher DPI.  Until our entire engine honors a DPI setting other than 96, we can't rely on the theme's
     // metrics.
+#ifdef Q_WS_MAC
+    const int ff = 16;
+#else
+    const int ff = 13;
+#endif
     if (style->width().isIntrinsicOrAuto())
-        style->setWidth(Length(13, Fixed));
+        style->setWidth(Length(ff, Fixed));
 
     if (style->height().isAuto())
-        style->setHeight(Length(13, Fixed));
+        style->setHeight(Length(ff, Fixed));
 }
 
 void RenderThemeQt::setRadioSize(RenderStyle* style) const
@@ -193,6 +198,7 @@ bool RenderThemeQt::supportsFocus(EAppearance appearance) const
         case PushButtonAppearance:
         case ButtonAppearance:
         case TextFieldAppearance:
+        case MenulistAppearance:
             return true;
         default: // No for all others...
             return false;
@@ -217,10 +223,13 @@ EAppearance RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con
     if (isHovered(o))
         option.state |= QStyle::State_MouseOver;
 
+    EAppearance result = o->style()->appearance();
+
     if (isPressed(o))
         option.state |= QStyle::State_Sunken;
+    else if (result == PushButtonAppearance)
+        option.state |= QStyle::State_Raised;
 
-    EAppearance result = o->style()->appearance();
     if(result == RadioAppearance || result == CheckboxAppearance)
         option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off);
 
@@ -327,6 +336,7 @@ bool RenderThemeQt::paintMenuList(RenderObject* o, const RenderObject::PaintInfo
     QStyleOptionComboBox opt;
     opt.initFrom(widget);
     opt.rect = r;
+    opt.frame = false;
     style->drawComplexControl(QStyle::CC_ComboBox, &opt, painter, widget);
     return false;
 }