Title: [93937] trunk
Revision
93937
Author
[email protected]
Date
2011-08-27 04:06:22 -0700 (Sat, 27 Aug 2011)

Log Message

[Qt] Need spin-button implementation
https://bugs.webkit.org/show_bug.cgi?id=65896

Patch by Jarred Nicholls <[email protected]> on 2011-08-27
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::adjustInnerSpinButtonStyle):
(WebCore::RenderThemeQt::paintInnerSpinButton):
* platform/qt/RenderThemeQt.h:

LayoutTests:

* platform/qt/Skipped:
* platform/qt/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.txt: Added.
* platform/qt/fast/forms/input-appearance-spinbutton-layer-expected.txt: Added.
* platform/qt/fast/forms/input-appearance-spinbutton-visibility-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (93936 => 93937)


--- trunk/LayoutTests/ChangeLog	2011-08-27 07:54:50 UTC (rev 93936)
+++ trunk/LayoutTests/ChangeLog	2011-08-27 11:06:22 UTC (rev 93937)
@@ -1,3 +1,15 @@
+2011-08-27  Jarred Nicholls  <[email protected]>
+
+        [Qt] Need spin-button implementation
+        https://bugs.webkit.org/show_bug.cgi?id=65896
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * platform/qt/Skipped:
+        * platform/qt/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.txt: Added.
+        * platform/qt/fast/forms/input-appearance-spinbutton-layer-expected.txt: Added.
+        * platform/qt/fast/forms/input-appearance-spinbutton-visibility-expected.txt: Added.
+
 2011-08-27  Csaba Osztrogonác  <[email protected]>
 
         [Qt] Unreviewed gardening.

Modified: trunk/LayoutTests/platform/qt/Skipped (93936 => 93937)


--- trunk/LayoutTests/platform/qt/Skipped	2011-08-27 07:54:50 UTC (rev 93936)
+++ trunk/LayoutTests/platform/qt/Skipped	2011-08-27 11:06:22 UTC (rev 93937)
@@ -1670,17 +1670,6 @@
 # https://bugs.webkit.org/show_bug.cgi?id=41241
 fast/text/bidi-explicit-embedding-past-end.html
 
-# Need to implement inner-spin-button
-# https://bugs.webkit.org/show_bug.cgi?id=65896
-fast/forms/input-appearance-spinbutton-disabled-readonly.html
-fast/forms/input-appearance-spinbutton-layer.html
-fast/forms/input-appearance-spinbutton-visibility.html
-fast/forms/input-number-events.html
-fast/forms/input-number-large-padding.html
-fast/forms/input-number-size.html
-fast/forms/input-spinbutton-capturing.html
-fast/forms/spin-button-gets-disabled-or-readonly.html
-
 # [Qt] fast/dom/beforeload/script-before-load-dynamic.html is crashy-flakey
 # https://bugs.webkit.org/show_bug.cgi?id=41452
 fast/dom/beforeload/remove-video-in-beforeload-listener.html

Added: trunk/LayoutTests/platform/qt/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.txt (0 => 93937)


--- trunk/LayoutTests/platform/qt/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/qt/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.txt	2011-08-27 11:06:22 UTC (rev 93937)
@@ -0,0 +1,47 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 783x17
+          text run at (0,0) width 783: "Test appearances of spin buttons. Disabled state and read-only state should have appearances different from the normal state."
+      RenderBlock {DIV} at (0,34) size 784x31
+        RenderInline {LABEL} at (0,0) size 414x17
+          RenderTextControl {INPUT} at (2,2) size 326x27
+            RenderDeprecatedFlexibleBox {DIV} at (2,2) size 322x23
+              RenderBlock {DIV} at (0,0) size 306x23
+          RenderText {#text} at (330,8) size 84x17
+            text run at (330,8) width 84: " Normal state"
+      RenderBlock {DIV} at (0,65) size 784x31
+        RenderInline {LABEL} at (0,0) size 422x17
+          RenderTextControl {INPUT} at (2,2) size 326x27
+            RenderDeprecatedFlexibleBox {DIV} at (2,2) size 322x23
+              RenderBlock {DIV} at (0,0) size 306x23
+          RenderText {#text} at (330,8) size 92x17
+            text run at (330,8) width 92: " Disabled state"
+      RenderBlock {DIV} at (0,96) size 784x31
+        RenderInline {LABEL} at (0,0) size 432x17
+          RenderTextControl {INPUT} at (2,2) size 326x27
+            RenderDeprecatedFlexibleBox {DIV} at (2,2) size 322x23
+              RenderBlock {DIV} at (0,0) size 306x23
+          RenderText {#text} at (330,8) size 102x17
+            text run at (330,8) width 102: " Read-only state"
+layer at (12,46) size 306x23
+  RenderBlock {DIV} at (0,0) size 306x23
+    RenderText {#text} at (1,0) size 10x22
+      text run at (1,0) width 10: "0"
+layer at (12,77) size 306x23
+  RenderBlock {DIV} at (0,0) size 306x23 [color=#545454]
+    RenderText {#text} at (1,0) size 10x22
+      text run at (1,0) width 10: "0"
+layer at (12,108) size 306x23
+  RenderBlock {DIV} at (0,0) size 306x23
+    RenderText {#text} at (1,0) size 10x22
+      text run at (1,0) width 10: "0"
+layer at (320,44) size 16x27
+  RenderBlock (relative positioned) {DIV} at (308,-2) size 16x27
+layer at (320,75) size 16x27
+  RenderBlock (relative positioned) {DIV} at (308,-2) size 16x27
+layer at (320,106) size 16x27
+  RenderBlock (relative positioned) {DIV} at (308,-2) size 16x27

Added: trunk/LayoutTests/platform/qt/fast/forms/input-appearance-spinbutton-layer-expected.txt (0 => 93937)


--- trunk/LayoutTests/platform/qt/fast/forms/input-appearance-spinbutton-layer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/qt/fast/forms/input-appearance-spinbutton-layer-expected.txt	2011-08-27 11:06:22 UTC (rev 93937)
@@ -0,0 +1,26 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x68
+  RenderBlock {HTML} at (0,0) size 800x68
+    RenderBody {BODY} at (8,8) size 784x52
+      RenderBR {BR} at (250,4) size 0x17
+      RenderTextControl {INPUT} at (2,28) size 246x22
+        RenderDeprecatedFlexibleBox {DIV} at (2,2) size 242x18
+          RenderBlock {DIV} at (0,0) size 226x18
+      RenderText {#text} at (0,0) size 0x0
+layer at (12,38) size 226x18
+  RenderBlock {DIV} at (0,0) size 226x18
+    RenderText {#text} at (1,0) size 16x17
+      text run at (1,0) width 16: "10"
+layer at (10,10) size 246x22
+  RenderTextControl {INPUT} at (2,2) size 246x22
+    RenderDeprecatedFlexibleBox {DIV} at (2,2) size 242x18
+      RenderBlock {DIV} at (0,0) size 226x18
+layer at (12,12) size 226x18
+  RenderBlock {DIV} at (0,0) size 226x18
+    RenderText {#text} at (1,0) size 16x17
+      text run at (1,0) width 16: "10"
+layer at (240,10) size 16x22
+  RenderBlock (relative positioned) {DIV} at (228,-2) size 16x22
+layer at (240,36) size 16x22
+  RenderBlock (relative positioned) {DIV} at (228,-2) size 16x22

Added: trunk/LayoutTests/platform/qt/fast/forms/input-appearance-spinbutton-visibility-expected.txt (0 => 93937)


--- trunk/LayoutTests/platform/qt/fast/forms/input-appearance-spinbutton-visibility-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/qt/fast/forms/input-appearance-spinbutton-visibility-expected.txt	2011-08-27 11:06:22 UTC (rev 93937)
@@ -0,0 +1,20 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x42
+  RenderBlock {HTML} at (0,0) size 800x42
+    RenderBody {BODY} at (8,8) size 784x26
+      RenderTextControl {INPUT} at (2,2) size 246x22
+        RenderDeprecatedFlexibleBox {DIV} at (2,2) size 242x18
+          RenderBlock {DIV} at (0,0) size 226x18
+      RenderText {#text} at (250,4) size 4x17
+        text run at (250,4) width 4: " "
+      RenderTextControl {INPUT} at (256,2) size 246x22
+        RenderDeprecatedFlexibleBox {DIV} at (2,2) size 242x18
+          RenderBlock {DIV} at (0,0) size 226x18
+      RenderText {#text} at (0,0) size 0x0
+layer at (12,12) size 226x18
+  RenderBlock {DIV} at (0,0) size 226x18
+layer at (266,12) size 226x18
+  RenderBlock {DIV} at (0,0) size 226x18
+layer at (240,10) size 16x22
+  RenderBlock (relative positioned) {DIV} at (228,-2) size 16x22

Modified: trunk/Source/WebCore/ChangeLog (93936 => 93937)


--- trunk/Source/WebCore/ChangeLog	2011-08-27 07:54:50 UTC (rev 93936)
+++ trunk/Source/WebCore/ChangeLog	2011-08-27 11:06:22 UTC (rev 93937)
@@ -1,3 +1,15 @@
+2011-08-27  Jarred Nicholls  <[email protected]>
+
+        [Qt] Need spin-button implementation
+        https://bugs.webkit.org/show_bug.cgi?id=65896
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * platform/qt/RenderThemeQt.cpp:
+        (WebCore::RenderThemeQt::adjustInnerSpinButtonStyle):
+        (WebCore::RenderThemeQt::paintInnerSpinButton):
+        * platform/qt/RenderThemeQt.h:
+
 2011-08-26  Xiaomei Ji  <[email protected]>
 
         Regression(91788): Bad cast in WebCore::blockWithNextLineBox

Modified: trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp (93936 => 93937)


--- trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp	2011-08-27 07:54:50 UTC (rev 93936)
+++ trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp	2011-08-27 11:06:22 UTC (rev 93937)
@@ -1068,6 +1068,58 @@
     return RenderTheme::paintSearchFieldResultsDecoration(o, pi, r);
 }
 
+void RenderThemeQt::adjustInnerSpinButtonStyle(CSSStyleSelector* selector, RenderStyle* style,
+                                               Element* e) const
+{
+    // Use the same width as our native scrollbar
+    int width = ScrollbarTheme::nativeTheme()->scrollbarThickness();
+    style->setWidth(Length(width, Fixed));
+    style->setMinWidth(Length(width, Fixed));
+}
+
+bool RenderThemeQt::paintInnerSpinButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    StylePainter p(this, paintInfo);
+    if (!p.isValid())
+       return true;
+
+    QStyleOptionSpinBox option;
+    initStyleOption(p.widget, option);
+    option.subControls = QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown;
+    if (!isReadOnlyControl(o)) {
+        if (isEnabled(o))
+            option.stepEnabled = QAbstractSpinBox::StepUpEnabled | QAbstractSpinBox::StepDownEnabled;
+        if (isPressed(o)) {
+            option.state |= QStyle::State_Sunken;
+            if (isSpinUpButtonPartPressed(o))
+                option.activeSubControls = QStyle::SC_SpinBoxUp;
+            else
+                option.activeSubControls = QStyle::SC_SpinBoxDown;
+        }
+    }
+
+    IntRect buttonRect = rect;
+    buttonRect.inflateY(-2);
+#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+    // QMacStyle will position the aqua buttons flush to the right.
+    // This will move them more left for better style, a la
+    // Chromium look & feel.
+    if (qobject_cast<QMacStyle*>(p.style)) {
+        buttonRect.inflateX(-4);
+        // Render mini aqua spin buttons for QMacStyle to fit nicely into
+        // the editor area, like Chromium.
+        option.state |= QStyle::State_Mini;
+#else
+    {
+        buttonRect.inflateX(-2);
+#endif
+    }
+    option.rect = buttonRect;
+
+    p.drawComplexControl(QStyle::CC_SpinBox, option);
+    return false;
+}
+
 bool RenderThemeQt::supportsFocus(ControlPart appearance) const
 {
     switch (appearance) {

Modified: trunk/Source/WebCore/platform/qt/RenderThemeQt.h (93936 => 93937)


--- trunk/Source/WebCore/platform/qt/RenderThemeQt.h	2011-08-27 07:54:50 UTC (rev 93936)
+++ trunk/Source/WebCore/platform/qt/RenderThemeQt.h	2011-08-27 11:06:22 UTC (rev 93937)
@@ -138,6 +138,9 @@
     virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&);
 
+    virtual void adjustInnerSpinButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+    virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&);
+
 #if ENABLE(PROGRESS_TAG)
     // Returns the repeat interval of the animation for the progress bar.
     virtual double animationRepeatIntervalForProgressBar(RenderProgress* renderProgress) const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to