Skip to content

Commit

Permalink
Fix drawing of menu fields
Browse files Browse the repository at this point in the history
Fixes #15460
  • Loading branch information
pulkomandy committed Oct 19, 2020
1 parent ff84f5c commit be2d5ee
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions Source/WebCore/platform/haiku/RenderThemeHaiku.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ bool RenderThemeHaiku::paintRadio(const RenderObject& object, const PaintInfo& i
BView* view = info.context().platformContext();
unsigned flags = flagsForObject(object);

view->PushState();
view->PushState();
be_control_look->DrawRadioButton(view, rect, rect, base, flags);
view->PopState();
view->PopState();
return false;
}

Expand All @@ -268,16 +268,16 @@ bool RenderThemeHaiku::paintButton(const RenderObject& object, const PaintInfo&

rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color background = base;
// TODO: From PaintInfo?
// TODO: From PaintInfo?
BRect rect = intRect;
BView* view = info.context().platformContext();
unsigned flags = flagsForObject(object);
if (isPressed(object))
flags |= BControlLook::B_ACTIVATED;
flags |= BControlLook::B_ACTIVATED;
if (isDefault(object))
flags |= BControlLook::B_DEFAULT_BUTTON;
flags |= BControlLook::B_DEFAULT_BUTTON;

view->PushState();
view->PushState();
be_control_look->DrawButtonFrame(view, rect, rect, base, background, flags);
be_control_look->DrawButtonBackground(view, rect, rect, base, flags);
view->PopState();
Expand All @@ -299,12 +299,12 @@ bool RenderThemeHaiku::paintTextField(const RenderObject& object, const PaintInf

rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
//rgb_color background = base;
// TODO: From PaintInfo?
// TODO: From PaintInfo?
BRect rect(intRect);
BView* view(info.context().platformContext());
unsigned flags = flagsForObject(object) & ~BControlLook::B_CLICKED;

view->PushState();
view->PushState();
be_control_look->DrawTextControlBorder(view, rect, rect, base, flags);
view->PopState();
return false;
Expand All @@ -330,7 +330,7 @@ void RenderThemeHaiku::adjustMenuListButtonStyle(RenderStyle& style, const Eleme
style.resetBorder();
style.resetBorderRadius();

int labelSpacing = be_control_look ? static_cast<int>(be_control_look->DefaultLabelSpacing()) : 3;
int labelSpacing = be_control_look ? static_cast<int>(be_control_look->DefaultLabelSpacing()) : 3;
// Position the text correctly within the select box and make the box wide enough to fit the dropdown button
style.setPaddingTop(Length(3, Fixed));
style.setPaddingLeft(Length(3 + labelSpacing, Fixed));
Expand All @@ -348,13 +348,7 @@ void RenderThemeHaiku::adjustMenuListButtonStyle(RenderStyle& style, const Eleme
style.setMinHeight(Length(minHeight, Fixed));
}

bool RenderThemeHaiku::paintMenuListButtonDecorations(const RenderBox& object, const PaintInfo& info, const FloatRect& rect)
{
// FIXME should it look more like a BMenuField instead?
return true; //paintButton(object, info, IntRect(rect));
}

bool RenderThemeHaiku::paintMenuList(const RenderObject& object, const PaintInfo& info, const FloatRect& intRect)
bool RenderThemeHaiku::paintMenuListButtonDecorations(const RenderBox& object, const PaintInfo& info, const FloatRect& floatRect)
{
if (info.context().paintingDisabled())
return true;
Expand All @@ -363,19 +357,26 @@ bool RenderThemeHaiku::paintMenuList(const RenderObject& object, const PaintInfo
return true;

rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
//rgb_color background = base;
// TODO: From PaintInfo?
BRect rect = intRect;
// TODO get the color from PaintInfo?
BRect rect = floatRect;
BView* view = info.context().platformContext();
unsigned flags = flagsForObject(object) & ~BControlLook::B_CLICKED;
unsigned flags = BControlLook::B_BLEND_FRAME;
// TODO unfortunately we don't get access to the RenderObject here so
// we can't use flagsForObject(object) & ~BControlLook::B_CLICKED;

view->PushState();
view->PushState();
be_control_look->DrawMenuFieldFrame(view, rect, rect, base, base, flags);
be_control_look->DrawMenuFieldBackground(view, rect, rect, base, true, flags);
view->PopState();
return false;
}

bool RenderThemeHaiku::paintMenuList(const RenderObject& object, const PaintInfo& info, const FloatRect& intRect)
{
// This is never called: the list is handled natively as a BMenu.
return true;
}

unsigned RenderThemeHaiku::flagsForObject(const RenderObject& object) const
{
unsigned flags = BControlLook::B_BLEND_FRAME;
Expand Down

0 comments on commit be2d5ee

Please sign in to comment.