Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2022-12-02 23:57:49 +08:00
commit 74a139ee22
19 changed files with 477 additions and 204 deletions

View file

@ -80,6 +80,8 @@ public:
// the first <label> element is clicked, that one may set this true.
// Then, the second <label> element won't handle the event.
bool mMultipleActionsPrevented : 1;
// Similar to above but expected to be used during PreHandleEvent phase.
bool mMultiplePreActionsPrevented : 1;
// If mIsBeingDispatched is true, the DOM event created from the event is
// dispatching into the DOM tree and not completed.
bool mIsBeingDispatched : 1;

View file

@ -275,6 +275,10 @@ public:
return result;
}
// If during mouseup handling we detect that click event might need to be
// dispatched, this is setup to be the target of the click event.
nsCOMPtr<dom::EventTarget> mClickTarget;
// mReason indicates the reason why the event is fired:
// - Representing mouse operation.
// - Synthesized for emulating mousemove event when the content under the

View file

@ -2905,7 +2905,7 @@ static NSMutableSet *gSwizzledFrameViewClasses = nil;
[super initWithContentRect:aContentRect styleMask:aStyle backing:aBufferingType defer:aFlag];
// MacOS 13 Ventura, doesn't seem to create the contentView... so create it ourselves
if(![super contentView]) {
[super setContentView:[[NSView alloc] initWithFrame:aContentRect]];
[super setContentView:[[[NSView alloc] initWithFrame:aContentRect] autorelease]];
}
mState = nil;
mActiveTitlebarColor = nil;
@ -3213,64 +3213,6 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
}
}
// Override methods that translate between content rect and frame rect.
- (NSRect)contentRectForFrameRect:(NSRect)aRect
{
if ([self drawsContentsIntoWindowFrame]) {
return aRect;
}
return [super contentRectForFrameRect:aRect];
}
- (NSRect)contentRectForFrameRect:(NSRect)aRect styleMask:(NSUInteger)aMask
{
if ([self drawsContentsIntoWindowFrame]) {
return aRect;
}
if ([super respondsToSelector:@selector(contentRectForFrameRect:styleMask:)]) {
return [super contentRectForFrameRect:aRect styleMask:aMask];
} else {
return [NSWindow contentRectForFrameRect:aRect styleMask:aMask];
}
}
- (NSRect)frameRectForContentRect:(NSRect)aRect
{
if ([self drawsContentsIntoWindowFrame]) {
return aRect;
}
return [super frameRectForContentRect:aRect];
}
- (NSRect)frameRectForContentRect:(NSRect)aRect styleMask:(NSUInteger)aMask
{
if ([self drawsContentsIntoWindowFrame]) {
return aRect;
}
if ([super respondsToSelector:@selector(frameRectForContentRect:styleMask:)]) {
return [super frameRectForContentRect:aRect styleMask:aMask];
} else {
return [NSWindow frameRectForContentRect:aRect styleMask:aMask];
}
}
- (void)setContentView:(NSView*)aView
{
[super setContentView:aView];
// Now move the contentView to the bottommost layer so that it's guaranteed
// to be under the window buttons.
NSView* frameView = [aView superview];
[aView removeFromSuperview];
if ([frameView respondsToSelector:@selector(_addKnownSubview:positioned:relativeTo:)]) {
// 10.10 prints a warning when we call addSubview on the frame view, so we
// silence the warning by calling a private method instead.
[frameView _addKnownSubview:aView positioned:NSWindowBelow relativeTo:nil];
} else {
[frameView addSubview:aView positioned:NSWindowBelow relativeTo:nil];
}
}
- (NSArray*)titlebarControls
{
// Return all subviews of the frameView which are not the content view.
@ -3504,6 +3446,64 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
return NSMaxY(frameRect) - NSMaxY(originalContentRect);
}
// Override methods that translate between content rect and frame rect.
- (NSRect)contentRectForFrameRect:(NSRect)aRect
{
if ([self drawsContentsIntoWindowFrame]) {
return aRect;
}
return [super contentRectForFrameRect:aRect];
}
- (NSRect)contentRectForFrameRect:(NSRect)aRect styleMask:(NSUInteger)aMask
{
if ([self drawsContentsIntoWindowFrame]) {
return aRect;
}
if ([super respondsToSelector:@selector(contentRectForFrameRect:styleMask:)]) {
return [super contentRectForFrameRect:aRect styleMask:aMask];
} else {
return [NSWindow contentRectForFrameRect:aRect styleMask:aMask];
}
}
- (NSRect)frameRectForContentRect:(NSRect)aRect
{
if ([self drawsContentsIntoWindowFrame]) {
return aRect;
}
return [super frameRectForContentRect:aRect];
}
- (NSRect)frameRectForContentRect:(NSRect)aRect styleMask:(NSUInteger)aMask
{
if ([self drawsContentsIntoWindowFrame]) {
return aRect;
}
if ([super respondsToSelector:@selector(frameRectForContentRect:styleMask:)]) {
return [super frameRectForContentRect:aRect styleMask:aMask];
} else {
return [NSWindow frameRectForContentRect:aRect styleMask:aMask];
}
}
- (void)setContentView:(NSView*)aView
{
[super setContentView:aView];
// Now move the contentView to the bottommost layer so that it's guaranteed
// to be under the window buttons.
NSView* frameView = [aView superview];
[aView removeFromSuperview];
if ([frameView respondsToSelector:@selector(_addKnownSubview:positioned:relativeTo:)]) {
// 10.10 prints a warning when we call addSubview on the frame view, so we
// silence the warning by calling a private method instead.
[frameView _addKnownSubview:aView positioned:NSWindowBelow relativeTo:nil];
} else {
[frameView addSubview:aView positioned:NSWindowBelow relativeTo:nil];
}
}
// Stores the complete height of titlebar + toolbar.
- (void)setUnifiedToolbarHeight:(CGFloat)aHeight
{

View file

@ -478,6 +478,7 @@ STUB(gtk_widget_unparent)
STUB(gtk_window_deiconify)
STUB(gtk_window_fullscreen)
STUB(gtk_window_get_group)
STUB(gtk_window_get_modal)
STUB(gtk_window_get_transient_for)
STUB(gtk_window_get_type)
STUB(gtk_window_get_type_hint)

View file

@ -100,7 +100,11 @@ NS_IMETHODIMP nsColorPicker::Open(nsIColorPickerShownCallback *aColorPickerShown
GtkWidget* color_chooser = gtk_color_chooser_dialog_new(title, parent_window);
if (parent_window) {
gtk_window_set_destroy_with_parent(GTK_WINDOW(color_chooser), TRUE);
GtkWindow *window = GTK_WINDOW(color_chooser);
gtk_window_set_destroy_with_parent(window, TRUE);
if (gtk_window_get_modal(parent_window)) {
gtk_window_set_modal(window, TRUE);
}
}
gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(color_chooser), FALSE);
@ -117,6 +121,9 @@ NS_IMETHODIMP nsColorPicker::Open(nsIColorPickerShownCallback *aColorPickerShown
GtkWindow *window = GTK_WINDOW(color_chooser);
gtk_window_set_transient_for(window, parent_window);
gtk_window_set_destroy_with_parent(window, TRUE);
if (gtk_window_get_modal(parent_window)) {
gtk_window_set_modal(window, TRUE);
}
}
GdkColor color_gdk = convertToGdkColor(color);