Bug 15236 - RenderTheme forces borders for MenulistButtonAppearance
Summary: RenderTheme forces borders for MenulistButtonAppearance
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 523.x (Safari 3)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-18 18:14 PDT by Matt Perry
Modified: 2007-10-17 16:28 PDT (History)
0 users

See Also:


Attachments
make some methods virtual (1.55 KB, patch)
2007-09-18 18:15 PDT, Matt Perry
aroben: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Perry 2007-09-18 18:14:59 PDT
MenulistButtonAppearance, which appears to be used for styled select controls, is given a rounded border.  This looks wrong in Windows when not using the "Safari" style theme, since Windows select dropdowns are square.  Platforms need more control over how this control is drawn.
Comment 1 Matt Perry 2007-09-18 18:15:49 PDT
Created attachment 16318 [details]
make some methods virtual

This simple patch just makes a few methods virtual so that platforms can override them with custom behavior.
Comment 2 Adam Roben (:aroben) 2007-09-22 13:37:55 PDT
Comment on attachment 16318 [details]
make some methods virtual

I don't think this is the right way to go about this. If this change were made, the <select>s computedStyle would still include the border-radius properties, even though we wouldn't be honoring them. Instead, you should override adjustMenuListButtonStyle, which is already virtual.
Comment 3 Matt Perry 2007-09-27 15:26:46 PDT
Hmm, yes, you're right.  Doing it this way results in the <select> being drawn as if its size included the border.

However, adjustMenuListButtonStyle seems insufficient.  The only way to prevent it from drawing the rounded border is to reset the border entirely, which is undesirable when the user explicitly sets a border.

I think the real fix involves fixing RenderObject::paintBorder so that it doesn't attempt to draw rounded corners in all cases.  (It only really makes sense on <select> controls that are styled the Mac way).
Comment 4 Adam Roben (:aroben) 2007-09-27 16:41:32 PDT
(In reply to comment #3)
> However, adjustMenuListButtonStyle seems insufficient.  The only way to prevent
> it from drawing the rounded border is to reset the border entirely, which is
> undesirable when the user explicitly sets a border.

Perhaps we need to change html4.css, then.

> I think the real fix involves fixing RenderObject::paintBorder so that it
> doesn't attempt to draw rounded corners in all cases.  (It only really makes
> sense on <select> controls that are styled the Mac way).

RenderObject::paintBorder does not always try to paint rounded borders:

    if (style->hasBorderRadius() &&
        static_cast<unsigned>(w) >= static_cast<unsigned>(topLeft.width()) + static_cast<unsigned>(topRight.width()) &&
        static_cast<unsigned>(w) >= static_cast<unsigned>(bottomLeft.width()) + static_cast<unsigned>(bottomRight.width()) &&
        static_cast<unsigned>(h) >= static_cast<unsigned>(topLeft.height()) + static_cast<unsigned>(bottomLeft.height()) &&
        static_cast<unsigned>(h) >= static_cast<unsigned>(topRight.height()) + static_cast<unsigned>(bottomRight.height()))
        renderRadii = true;
Comment 5 Matt Perry 2007-10-17 16:28:35 PDT
(In reply to comment #4)
> RenderObject::paintBorder does not always try to paint rounded borders:
> 
>     if (style->hasBorderRadius() &&
>         static_cast<unsigned>(w) >= static_cast<unsigned>(topLeft.width()) +
> static_cast<unsigned>(topRight.width()) &&
>         static_cast<unsigned>(w) >= static_cast<unsigned>(bottomLeft.width()) +
> static_cast<unsigned>(bottomRight.width()) &&
>         static_cast<unsigned>(h) >= static_cast<unsigned>(topLeft.height()) +
> static_cast<unsigned>(bottomLeft.height()) &&
>         static_cast<unsigned>(h) >= static_cast<unsigned>(topRight.height()) +
> static_cast<unsigned>(bottomRight.height()))
>         renderRadii = true;
> 

You're right again.  I suppose resetting the border radius would achieve the effect I want.  Closing as WORKSFORME.