Fix cocoa usage of render internals
This commit is contained in:
parent
79e501075a
commit
a50d2035a7
|
@ -22,6 +22,13 @@
|
|||
#import "desktop/browser.h"
|
||||
#import "render/form.h"
|
||||
|
||||
static inline NSRect cocoa_rect_for_control( struct browser_window *bw, struct form_control *control)
|
||||
{
|
||||
struct rect r;
|
||||
form_control_bounding_rect(control, &r);
|
||||
return cocoa_scaled_rect(browser_window_get_scale(bw), r.x0, r.y0, r.x1, r.y1 );
|
||||
}
|
||||
|
||||
@interface FormSelectMenu ()
|
||||
|
||||
- (void) itemSelected: (id) sender;
|
||||
|
@ -80,7 +87,7 @@
|
|||
cell = [[NSPopUpButtonCell alloc] initTextCell: @"" pullsDown: YES];
|
||||
[cell setMenu: menu];
|
||||
|
||||
const NSRect rect = cocoa_rect_for_box( browser, control->box );
|
||||
const NSRect rect = cocoa_rect_for_control(browser, control);
|
||||
|
||||
[cell attachPopUpWithFrame: rect inView: view];
|
||||
[cell performClickWithFrame: rect inView: view];
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include "utils/utils.h"
|
||||
#import "desktop/browser.h"
|
||||
#import "render/box.h"
|
||||
|
||||
extern CGFloat cocoa_scale_factor;
|
||||
|
||||
|
@ -105,11 +104,5 @@ static inline NSRect cocoa_scaled_rect( CGFloat scale, int x0, int y0, int x1, i
|
|||
return cocoa_scaled_rect_wh( scale, x0, y0, x1 - x0, y1 - y0 );
|
||||
}
|
||||
|
||||
static inline NSRect cocoa_rect_for_box( struct browser_window *bw, struct box *box )
|
||||
{
|
||||
struct rect r;
|
||||
box_bounds( box, &r );
|
||||
return cocoa_scaled_rect(browser_window_get_scale(bw), r.x0, r.y0, r.x1, r.y1 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1352,6 +1352,14 @@ char *form_control_get_name(struct form_control *control)
|
|||
return control->name;
|
||||
}
|
||||
|
||||
/* exported interface documented in render/form.h */
|
||||
nserror form_control_bounding_rect(struct form_control *control, struct rect *r)
|
||||
{
|
||||
box_bounds( control->box, r );
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle a click on the area of the currently opened select menu.
|
||||
*
|
||||
|
|
|
@ -62,4 +62,14 @@ struct form_option *form_select_get_option(struct form_control *control, int ite
|
|||
*/
|
||||
char *form_control_get_name(struct form_control *control);
|
||||
|
||||
|
||||
/**
|
||||
* Get a form control bounding rectangle
|
||||
*
|
||||
* \param[in] control The form control
|
||||
* \param[out] r The rectangle to place the bounds in.
|
||||
* \return NSERROR_OK on success or error code.
|
||||
*/
|
||||
nserror form_control_bounding_rect(struct form_control *control, struct rect *r);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue