Changeset 56555 in webkit


Ignore:
Timestamp:
Mar 25, 2010 10:30:23 AM (14 years ago)
Author:
jwieczorek@webkit.org
Message:

2010-03-25 Jakub Wieczorek <jwieczorek@webkit.org>

Reviewed by Eric Seidel.

[Qt] RenderTheme: fix size adjustment for text fields
https://bugs.webkit.org/show_bug.cgi?id=36413

Update test results after RenderTheme changes.

  • platform/qt/fast/forms/textarea-placeholder-pseudo-style-expected.txt:
  • platform/qt/fast/forms/textarea-placeholder-set-attribute-expected.txt:
  • platform/qt/fast/forms/textarea-placeholder-set-value-expected.txt:

2010-03-25 Jakub Wieczorek <jwieczorek@webkit.org>

Reviewed by Eric Seidel.

[Qt] RenderTheme: fix size adjustment for text fields
https://bugs.webkit.org/show_bug.cgi?id=36413

To match other ports, remove the hardcoded dimensions for text fields so that
the default ones from WebCore can be used.
Properly apply the correct padding to text areas - this fixes their appearance
with the Oxygen style.

  • platform/qt/RenderThemeQt.cpp: (WebCore::RenderThemeQt::computeSizeBasedOnStyle):
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r56550 r56555  
     12010-03-25  Jakub Wieczorek  <jwieczorek@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        [Qt] RenderTheme: fix size adjustment for text fields
     6        https://bugs.webkit.org/show_bug.cgi?id=36413
     7
     8        Update test results after RenderTheme changes.
     9
     10        * platform/qt/fast/forms/textarea-placeholder-pseudo-style-expected.txt:
     11        * platform/qt/fast/forms/textarea-placeholder-set-attribute-expected.txt:
     12        * platform/qt/fast/forms/textarea-placeholder-set-value-expected.txt:
     13
    1142010-03-25  Julien Chaffraix  <jchaffraix@webkit.org>
    215
  • trunk/LayoutTests/platform/qt/fast/forms/textarea-placeholder-pseudo-style-expected.txt

    r50878 r56555  
    1414        text run at (548,48) width 4: " "
    1515      RenderText {#text} at (0,0) size 0x0
    16 layer at (10,30) size 176x40
    17   RenderTextControl {TEXTAREA} at (2,22) size 176x40
    18     RenderBlock {DIV} at (0,0) size 176x20 [color=#640000]
     16layer at (10,30) size 180x44
     17  RenderTextControl {TEXTAREA} at (2,22) size 180x44
     18    RenderBlock {DIV} at (2,2) size 176x20 [color=#640000]
    1919      RenderText {#text} at (0,0) size 25x20
    2020        text run at (0,0) width 25: "text"
    21 layer at (194,30) size 176x40
    22   RenderTextControl {TEXTAREA} at (186,22) size 176x40
    23     RenderBlock {DIV} at (0,0) size 176x20 [color=#640000]
     21layer at (198,30) size 180x44
     22  RenderTextControl {TEXTAREA} at (190,22) size 180x44
     23    RenderBlock {DIV} at (2,2) size 176x20 [color=#640000]
    2424      RenderText {#text} at (0,0) size 90x20
    2525        text run at (0,0) width 90: "disabled text"
    26 layer at (378,30) size 176x40
    27   RenderTextControl {TEXTAREA} at (370,22) size 176x40
    28     RenderBlock {DIV} at (0,0) size 176x20 [color=#A9A9A9]
     26layer at (386,30) size 180x44
     27  RenderTextControl {TEXTAREA} at (378,22) size 180x44
     28    RenderBlock {DIV} at (2,2) size 176x20 [color=#A9A9A9]
    2929      RenderText {#text} at (0,0) size 48x20
    3030        text run at (0,0) width 48: "default"
    31 layer at (562,30) size 176x40
    32   RenderTextControl {TEXTAREA} at (554,22) size 176x40
    33     RenderBlock {DIV} at (0,0) size 176x20 [color=#555555]
     31layer at (574,30) size 180x44
     32  RenderTextControl {TEXTAREA} at (566,22) size 180x44
     33    RenderBlock {DIV} at (2,2) size 176x20 [color=#555555]
    3434      RenderText {#text} at (0,0) size 113x20
    3535        text run at (0,0) width 113: "default disabled"
  • trunk/LayoutTests/platform/qt/fast/forms/textarea-placeholder-set-attribute-expected.txt

    r50878 r56555  
    88          text run at (0,0) width 486: "If you can see the word \"Placeholder\" in the text area, then all is well."
    99      RenderBlock {P} at (0,36) size 784x44
    10 layer at (10,46) size 176x40
    11   RenderTextControl {TEXTAREA} at (2,2) size 176x40
    12     RenderBlock {DIV} at (0,0) size 176x20 [color=#A9A9A9]
     10layer at (10,46) size 180x44
     11  RenderTextControl {TEXTAREA} at (2,2) size 180x44
     12    RenderBlock {DIV} at (2,2) size 176x20 [color=#A9A9A9]
    1313      RenderText {#text} at (0,0) size 86x20
    1414        text run at (0,0) width 86: "Placeholder"
  • trunk/LayoutTests/platform/qt/fast/forms/textarea-placeholder-set-value-expected.txt

    r50878 r56555  
    1616        RenderText {#text} at (0,0) size 0x0
    1717        RenderText {#text} at (0,0) size 0x0
    18 layer at (10,46) size 176x40
    19   RenderTextControl {TEXTAREA} at (2,2) size 176x40
    20     RenderBlock {DIV} at (0,0) size 176x20
     18layer at (10,46) size 180x44
     19  RenderTextControl {TEXTAREA} at (2,2) size 180x44
     20    RenderBlock {DIV} at (2,2) size 176x20
    2121      RenderText {#text} at (0,0) size 62x20
    2222        text run at (0,0) width 62: "New text"
  • trunk/WebCore/ChangeLog

    r56552 r56555  
     12010-03-25  Jakub Wieczorek  <jwieczorek@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        [Qt] RenderTheme: fix size adjustment for text fields
     6        https://bugs.webkit.org/show_bug.cgi?id=36413
     7
     8        To match other ports, remove the hardcoded dimensions for text fields so that
     9        the default ones from WebCore can be used.
     10        Properly apply the correct padding to text areas - this fixes their appearance
     11        with the Oxygen style.
     12
     13        * platform/qt/RenderThemeQt.cpp:
     14        (WebCore::RenderThemeQt::computeSizeBasedOnStyle):
     15
    1162010-03-25  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    217
  • trunk/WebCore/platform/qt/RenderThemeQt.cpp

    r56343 r56555  
    314314void RenderThemeQt::computeSizeBasedOnStyle(RenderStyle* renderStyle) const
    315315{
     316    QSize size(0, 0);
     317    const QFontMetrics fm(renderStyle->font().font());
     318    QStyle* style = qStyle();
     319
     320    switch (renderStyle->appearance()) {
     321    case TextAreaPart:
     322    case TextFieldPart: {
     323        int padding = findFrameLineWidth(style);
     324
     325        renderStyle->setPaddingLeft(Length(padding, Fixed));
     326        renderStyle->setPaddingRight(Length(padding, Fixed));
     327        renderStyle->setPaddingTop(Length(padding, Fixed));
     328        renderStyle->setPaddingBottom(Length(padding, Fixed));
     329        break;
     330    }
     331    default:
     332        break;
     333    }
     334
    316335    // If the width and height are both specified, then we have nothing to do.
    317336    if (!renderStyle->width().isIntrinsicOrAuto() && !renderStyle->height().isAuto())
    318337        return;
    319 
    320     QSize size(0, 0);
    321     const QFontMetrics fm(renderStyle->font().font());
    322     QStyle* style = qStyle();
    323338
    324339    switch (renderStyle->appearance()) {
     
    364379                                                     &styleOption, QSize(0, contentHeight), 0);
    365380        size.setHeight(menuListSize.height());
    366         break;
    367     }
    368     case TextFieldPart: {
    369         const int verticalMargin = 1;
    370         const int horizontalMargin = 2;
    371         int h = qMax(fm.lineSpacing(), 14) + 2*verticalMargin;
    372         int w = fm.width(QLatin1Char('x')) * 17 + 2*horizontalMargin;
    373         QStyleOptionFrameV2 opt;
    374         opt.lineWidth = findFrameLineWidth(style);
    375         QSize sz = style->sizeFromContents(QStyle::CT_LineEdit,
    376                                            &opt,
    377                                            QSize(w, h).expandedTo(QApplication::globalStrut()),
    378                                            0);
    379         size.setHeight(sz.height());
    380 
    381         renderStyle->setPaddingLeft(Length(opt.lineWidth, Fixed));
    382         renderStyle->setPaddingRight(Length(opt.lineWidth, Fixed));
    383381        break;
    384382    }
Note: See TracChangeset for help on using the changeset viewer.