Changeset 43903 in webkit


Ignore:
Timestamp:
May 20, 2009 5:33:57 AM (15 years ago)
Author:
eric@webkit.org
Message:

2009-05-20 Takeshi Yoshino <tyoshino@google.com>

Reviewed by Eric Seidel.

Bug 24539: Fix RenderThemeChromiumWin::paintTextFieldInternal() not to hide background image.
https://bugs.webkit.org/show_bug.cgi?id=24539

Fix RenderThemeChromiumWin::paintTextFieldInternal().

We shouldn't paint the content area of text fields when o->style() has
background image or transparent background color. paintTextFieldInternal() is
used for painting inner area of HTML option elements by Chromium.

When we pass fillContentArea = true to ChromiumBridge::paintTextField, it hides
the background image rendered by RenderBoxModelObject. So, we should set
fillContentArea = false in such case.

Besides, when background-color:transparent is specified for CSS property,
o->style().backgroundColor returns black color with alpha channel == 0. But
since ThemeEngine for Windows behind ChromiumBridge::paintTextField cannot
recognize alpha channel, it fills the rect with black. I made workaround to set
fillContentArea = false when alpha channel == 0 to avoid this.

And more, I'd like to fallback the color passed to ChromiumBridge to white when
o->style()->backgroundColor() is invalid.

  • rendering/RenderThemeChromiumWin.cpp: (WebCore::RenderThemeChromiumWin::paintTextFieldInternal):
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r43902 r43903  
     12009-05-20  Takeshi Yoshino  <tyoshino@google.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Bug 24539: Fix RenderThemeChromiumWin::paintTextFieldInternal() not to hide background image.
     6        https://bugs.webkit.org/show_bug.cgi?id=24539
     7
     8        Changed the test fast/forms/select-style.html to exercise the change on
     9        RenderThemeChromiumWin::paintTextFieldInternal() on Chromium. Replaced expected results for
     10        platform mac. Expected cases for the other platforms are to be replaced later.
     11
     12        * fast/forms/select-style.html:
     13        * platform/mac/fast/forms/select-style-expected.checksum:
     14        * platform/mac/fast/forms/select-style-expected.txt:
     15
    1162009-05-20  Shinichiro Hamaji  <hamaji@google.com>
    217
  • trunk/LayoutTests/fast/forms/select-style.html

    r15316 r43903  
    1 This tests that styled popups look right.  (Aqua for now- later, we will honor the styling).
    2 
    3 <br>
     1This tests that styled popups look right.  (Aqua for now- later, we will honor the styling).<br>
    42<select style="background-color:red">
    53<option>test</option>
    64</select>
     5<br>
     6
     7This tests that background color is white by default regardless of the parent element.<br>
     8<span style="padding:5px;background-color:red">
     9<select>
     10<option>test</option>
     11</select>
     12</span>
     13<br>
     14
     15This tests that background color is inherited from the parent if background-color:inherit is specified.<br>
     16<span style="padding:5px;background-color:red">
     17<select style="background:inherit">
     18<option>test</option>
     19</select>
     20</span>
     21<br>
     22
     23This tests that background color is the same as the parent if background-color:transparent is specified.<br>
     24<span style="padding:5px;background-color:red">
     25<select style="background-color:transparent">
     26<option>test</option>
     27</select>
     28</span>
     29<br>
     30
     31This tests that background is white if only background-image:none is specified.<br>
     32<select style="background-image:none">
     33<option>test</option>
     34</select>
     35<br>
     36
     37This tests that the image specified for background-image is visible.<br>
     38<select style="background-image:url(resources/apple.gif)">
     39<option>test</option>
     40</select>
  • trunk/LayoutTests/platform/mac/fast/forms/select-style-expected.checksum

    r43355 r43903  
    1 28cdec7314ab960c23f5137e8b9c91ee
     1ec7192fc686a442b88f31eea7e7b89aa
  • trunk/LayoutTests/platform/mac/fast/forms/select-style-expected.txt

    r30635 r43903  
    44  RenderBlock {HTML} at (0,0) size 800x600
    55    RenderBody {BODY} at (8,8) size 784x584
    6       RenderText {#text} at (0,0) size 558x18
     6      RenderText {#text} at (0,0) size 554x18
    77        text run at (0,0) width 250: "This tests that styled popups look right. "
    8         text run at (250,0) width 308: "(Aqua for now- later, we will honor the styling). "
    9       RenderBR {BR} at (0,0) size 0x0
     8        text run at (250,0) width 304: "(Aqua for now- later, we will honor the styling)."
     9      RenderBR {BR} at (554,14) size 0x0
    1010      RenderMenuList {SELECT} at (2,20) size 51x18 [bgcolor=#FF0000] [border: (1px solid #000000)]
    1111        RenderBlock (anonymous) at (1,1) size 49x16
    1212          RenderText at (8,1) size 20x13
    1313            text run at (8,1) width 20: "test"
     14      RenderText {#text} at (55,19) size 4x18
     15        text run at (55,19) width 4: " "
     16      RenderBR {BR} at (59,33) size 0x0
     17      RenderText {#text} at (0,40) size 528x18
     18        text run at (0,40) width 528: "This tests that background color is white by default regardless of the parent element."
     19      RenderBR {BR} at (528,54) size 0x0
     20      RenderInline {SPAN} at (0,0) size 69x28 [bgcolor=#FF0000]
     21        RenderText {#text} at (0,0) size 0x0
     22        RenderMenuList {SELECT} at (7,60) size 51x18 [bgcolor=#FFFFFF]
     23          RenderBlock (anonymous) at (0,0) size 51x18
     24            RenderText at (8,2) size 20x13
     25              text run at (8,2) width 20: "test"
     26        RenderText {#text} at (60,59) size 4x18
     27          text run at (60,59) width 4: " "
     28      RenderText {#text} at (0,0) size 0x0
     29      RenderBR {BR} at (0,0) size 0x0
     30      RenderText {#text} at (0,80) size 625x18
     31        text run at (0,80) width 625: "This tests that background color is inherited from the parent if background-color:inherit is specified."
     32      RenderBR {BR} at (625,94) size 0x0
     33      RenderInline {SPAN} at (0,0) size 69x28 [bgcolor=#FF0000]
     34        RenderText {#text} at (0,0) size 0x0
     35        RenderMenuList {SELECT} at (7,100) size 51x18 [border: (1px solid #000000)]
     36          RenderBlock (anonymous) at (1,1) size 49x16
     37            RenderText at (8,1) size 20x13
     38              text run at (8,1) width 20: "test"
     39        RenderText {#text} at (60,99) size 4x18
     40          text run at (60,99) width 4: " "
     41      RenderText {#text} at (0,0) size 0x0
     42      RenderBR {BR} at (0,0) size 0x0
     43      RenderText {#text} at (0,120) size 637x18
     44        text run at (0,120) width 637: "This tests that background color is the same as the parent if background-color:transparent is specified."
     45      RenderBR {BR} at (637,134) size 0x0
     46      RenderInline {SPAN} at (0,0) size 69x28 [bgcolor=#FF0000]
     47        RenderText {#text} at (0,0) size 0x0
     48        RenderMenuList {SELECT} at (7,140) size 51x18 [border: (1px solid #000000)]
     49          RenderBlock (anonymous) at (1,1) size 49x16
     50            RenderText at (8,1) size 20x13
     51              text run at (8,1) width 20: "test"
     52        RenderText {#text} at (60,139) size 4x18
     53          text run at (60,139) width 4: " "
     54      RenderText {#text} at (0,0) size 0x0
     55      RenderBR {BR} at (0,0) size 0x0
     56      RenderText {#text} at (0,160) size 498x18
     57        text run at (0,160) width 498: "This tests that background is white if only background-image:none is specified."
     58      RenderBR {BR} at (498,174) size 0x0
     59      RenderMenuList {SELECT} at (2,180) size 51x18 [bgcolor=#FFFFFF]
     60        RenderBlock (anonymous) at (0,0) size 51x18
     61          RenderText at (8,2) size 20x13
     62            text run at (8,2) width 20: "test"
     63      RenderText {#text} at (55,179) size 4x18
     64        text run at (55,179) width 4: " "
     65      RenderBR {BR} at (59,193) size 0x0
     66      RenderText {#text} at (0,200) size 418x18
     67        text run at (0,200) width 418: "This tests that the image specified for background-image is visible."
     68      RenderBR {BR} at (418,214) size 0x0
     69      RenderMenuList {SELECT} at (2,220) size 51x18 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     70        RenderBlock (anonymous) at (1,1) size 49x16
     71          RenderText at (8,1) size 20x13
     72            text run at (8,1) width 20: "test"
     73      RenderText {#text} at (0,0) size 0x0
  • trunk/WebCore/ChangeLog

    r43902 r43903  
     12009-05-20  Takeshi Yoshino <tyoshino@google.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Bug 24539: Fix RenderThemeChromiumWin::paintTextFieldInternal() not to hide background image.
     6        https://bugs.webkit.org/show_bug.cgi?id=24539
     7
     8        Fix RenderThemeChromiumWin::paintTextFieldInternal().
     9
     10        We shouldn't paint the content area of text fields when o->style() has
     11        background image or transparent background color. paintTextFieldInternal() is
     12        used for painting inner area of HTML option elements by Chromium.
     13
     14        When we pass fillContentArea = true to ChromiumBridge::paintTextField, it hides
     15        the background image rendered by RenderBoxModelObject. So, we should set
     16        fillContentArea = false in such case.
     17
     18        Besides, when background-color:transparent is specified for CSS property,
     19        o->style().backgroundColor returns black color with alpha channel == 0. But
     20        since ThemeEngine for Windows behind ChromiumBridge::paintTextField cannot
     21        recognize alpha channel, it fills the rect with black. I made workaround to set
     22        fillContentArea = false when alpha channel == 0 to avoid this.
     23
     24        And more, I'd like to fallback the color passed to ChromiumBridge to white when
     25        o->style()->backgroundColor() is invalid.
     26
     27        * rendering/RenderThemeChromiumWin.cpp:
     28        (WebCore::RenderThemeChromiumWin::paintTextFieldInternal):
     29
    1302009-05-20  Shinichiro Hamaji  <hamaji@google.com>
    231
  • trunk/WebCore/rendering/RenderThemeChromiumWin.cpp

    r43002 r43903  
    803803    const ThemeData& themeData = getThemeData(o);
    804804
     805    // Fallback to white if the specified color object is invalid.
     806    Color backgroundColor(Color::white);
     807    if (o->style()->backgroundColor().isValid()) {
     808        backgroundColor = o->style()->backgroundColor();
     809    }
     810
     811    // If we have background-image, don't fill the content area to expose the
     812    // parent's background. Also, we shouldn't fill the content area if the
     813    // alpha of the color is 0. The API of Windows GDI ignores the alpha.
     814    //
     815    // Note that we should paint the content area white if we have neither the
     816    // background color nor background image explicitly specified to keep the
     817    // appearance of select element consistent with other browsers.
     818    bool fillContentArea = !o->style()->hasBackgroundImage() && backgroundColor.alpha() != 0;
     819
    805820    WebCore::ThemePainter painter(i.context, r);
    806821    ChromiumBridge::paintTextField(painter.context(),
     
    809824                                   themeData.m_classicState,
    810825                                   painter.drawRect(),
    811                                    o->style()->backgroundColor(),
    812                                    true,
     826                                   backgroundColor,
     827                                   fillContentArea,
    813828                                   drawEdges);
    814829    return false;
Note: See TracChangeset for help on using the changeset viewer.