Skip to content

Commit be2d5ee

Browse files
committed
Fix drawing of menu fields
Fixes #15460
1 parent ff84f5c commit be2d5ee

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

Source/WebCore/platform/haiku/RenderThemeHaiku.cpp

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ bool RenderThemeHaiku::paintRadio(const RenderObject& object, const PaintInfo& i
246246
BView* view = info.context().platformContext();
247247
unsigned flags = flagsForObject(object);
248248

249-
view->PushState();
249+
view->PushState();
250250
be_control_look->DrawRadioButton(view, rect, rect, base, flags);
251-
view->PopState();
251+
view->PopState();
252252
return false;
253253
}
254254

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

269269
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
270270
rgb_color background = base;
271-
// TODO: From PaintInfo?
271+
// TODO: From PaintInfo?
272272
BRect rect = intRect;
273273
BView* view = info.context().platformContext();
274274
unsigned flags = flagsForObject(object);
275275
if (isPressed(object))
276-
flags |= BControlLook::B_ACTIVATED;
276+
flags |= BControlLook::B_ACTIVATED;
277277
if (isDefault(object))
278-
flags |= BControlLook::B_DEFAULT_BUTTON;
278+
flags |= BControlLook::B_DEFAULT_BUTTON;
279279

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

300300
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
301301
//rgb_color background = base;
302-
// TODO: From PaintInfo?
302+
// TODO: From PaintInfo?
303303
BRect rect(intRect);
304304
BView* view(info.context().platformContext());
305305
unsigned flags = flagsForObject(object) & ~BControlLook::B_CLICKED;
306306

307-
view->PushState();
307+
view->PushState();
308308
be_control_look->DrawTextControlBorder(view, rect, rect, base, flags);
309309
view->PopState();
310310
return false;
@@ -330,7 +330,7 @@ void RenderThemeHaiku::adjustMenuListButtonStyle(RenderStyle& style, const Eleme
330330
style.resetBorder();
331331
style.resetBorderRadius();
332332

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

351-
bool RenderThemeHaiku::paintMenuListButtonDecorations(const RenderBox& object, const PaintInfo& info, const FloatRect& rect)
352-
{
353-
// FIXME should it look more like a BMenuField instead?
354-
return true; //paintButton(object, info, IntRect(rect));
355-
}
356-
357-
bool RenderThemeHaiku::paintMenuList(const RenderObject& object, const PaintInfo& info, const FloatRect& intRect)
351+
bool RenderThemeHaiku::paintMenuListButtonDecorations(const RenderBox& object, const PaintInfo& info, const FloatRect& floatRect)
358352
{
359353
if (info.context().paintingDisabled())
360354
return true;
@@ -363,19 +357,26 @@ bool RenderThemeHaiku::paintMenuList(const RenderObject& object, const PaintInfo
363357
return true;
364358

365359
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
366-
//rgb_color background = base;
367-
// TODO: From PaintInfo?
368-
BRect rect = intRect;
360+
// TODO get the color from PaintInfo?
361+
BRect rect = floatRect;
369362
BView* view = info.context().platformContext();
370-
unsigned flags = flagsForObject(object) & ~BControlLook::B_CLICKED;
363+
unsigned flags = BControlLook::B_BLEND_FRAME;
364+
// TODO unfortunately we don't get access to the RenderObject here so
365+
// we can't use flagsForObject(object) & ~BControlLook::B_CLICKED;
371366

372-
view->PushState();
367+
view->PushState();
373368
be_control_look->DrawMenuFieldFrame(view, rect, rect, base, base, flags);
374369
be_control_look->DrawMenuFieldBackground(view, rect, rect, base, true, flags);
375370
view->PopState();
376371
return false;
377372
}
378373

374+
bool RenderThemeHaiku::paintMenuList(const RenderObject& object, const PaintInfo& info, const FloatRect& intRect)
375+
{
376+
// This is never called: the list is handled natively as a BMenu.
377+
return true;
378+
}
379+
379380
unsigned RenderThemeHaiku::flagsForObject(const RenderObject& object) const
380381
{
381382
unsigned flags = BControlLook::B_BLEND_FRAME;

0 commit comments

Comments
 (0)