2001-11-06 18:35:24 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2005-09-30 04:59:29 +04:00
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#ifndef nsChildView_h_
|
|
|
|
#define nsChildView_h_
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2006-09-11 19:47:35 +04:00
|
|
|
// formal protocols
|
2007-01-18 09:34:07 +03:00
|
|
|
#include "mozView.h"
|
2006-09-11 19:47:35 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-05-29 05:18:45 +04:00
|
|
|
# include "mozilla/a11y/Accessible.h"
|
2007-01-18 09:34:07 +03:00
|
|
|
# include "mozAccessibleProtocol.h"
|
2006-09-11 19:47:35 +04:00
|
|
|
#endif
|
2002-04-05 01:35:20 +04:00
|
|
|
|
2001-11-06 18:35:24 +03:00
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsBaseWidget.h"
|
2018-10-31 23:39:03 +03:00
|
|
|
#include "nsIWeakReferenceUtils.h"
|
2011-05-08 14:19:15 +04:00
|
|
|
#include "TextInputHandler.h"
|
2009-10-01 06:52:50 +04:00
|
|
|
#include "nsCocoaUtils.h"
|
2013-01-17 02:59:23 +04:00
|
|
|
#include "gfxQuartzSurface.h"
|
2013-09-04 16:14:52 +04:00
|
|
|
#include "GLContextTypes.h"
|
|
|
|
#include "mozilla/Mutex.h"
|
|
|
|
#include "nsRegion.h"
|
2013-09-25 15:21:18 +04:00
|
|
|
#include "mozilla/MouseEvents.h"
|
2014-08-28 04:15:33 +04:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2017-06-22 01:58:41 +03:00
|
|
|
#include "mozilla/webrender/WebRenderTypes.h"
|
2001-11-06 18:35:24 +03:00
|
|
|
|
|
|
|
#include "nsString.h"
|
2006-10-26 02:45:22 +04:00
|
|
|
#include "nsIDragService.h"
|
2016-07-11 23:15:07 +03:00
|
|
|
#include "ViewRegion.h"
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2007-04-06 04:26:53 +04:00
|
|
|
#import <Carbon/Carbon.h>
|
2001-11-06 18:35:24 +03:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2010-04-28 02:29:29 +04:00
|
|
|
#import <AppKit/NSOpenGL.h>
|
2001-11-06 18:35:24 +03:00
|
|
|
|
|
|
|
class nsChildView;
|
2009-08-14 02:06:49 +04:00
|
|
|
class nsCocoaWindow;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2013-07-09 08:21:05 +04:00
|
|
|
namespace {
|
|
|
|
class GLPresenter;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace
|
2012-01-19 18:45:37 +04:00
|
|
|
|
2013-07-09 08:21:05 +04:00
|
|
|
namespace mozilla {
|
2015-08-24 02:50:29 +03:00
|
|
|
class InputData;
|
2015-08-27 23:07:59 +03:00
|
|
|
class PanGestureInput;
|
|
|
|
class SwipeTracker;
|
2015-08-12 07:15:32 +03:00
|
|
|
struct SwipeEventQueue;
|
2015-08-27 23:07:59 +03:00
|
|
|
class VibrancyManager;
|
2012-01-19 18:45:37 +04:00
|
|
|
namespace layers {
|
2013-04-17 01:35:57 +04:00
|
|
|
class GLManager;
|
2016-07-20 14:37:00 +03:00
|
|
|
class IAPZCTreeManager;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
2016-06-29 06:24:44 +03:00
|
|
|
namespace widget {
|
|
|
|
class RectTextureImage;
|
2016-11-08 05:16:52 +03:00
|
|
|
class WidgetRenderingContext;
|
2016-06-29 06:24:44 +03:00
|
|
|
} // namespace widget
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2011-02-20 01:23:02 +03:00
|
|
|
|
2019-02-13 20:50:41 +03:00
|
|
|
@class PixelHostingView;
|
|
|
|
|
2008-06-30 20:30:22 +04:00
|
|
|
@interface NSEvent (Undocumented)
|
|
|
|
|
|
|
|
// Return Cocoa event's corresponding Carbon event. Not initialized (on
|
|
|
|
// synthetic events) until the OS actually "sends" the event. This method
|
|
|
|
// has been present in the same form since at least OS X 10.2.8.
|
|
|
|
- (EventRef)_eventRef;
|
|
|
|
|
2016-11-16 06:50:37 +03:00
|
|
|
// stage From 10.10.3 for force touch event
|
|
|
|
@property(readonly) NSInteger stage;
|
|
|
|
|
2008-06-30 20:30:22 +04:00
|
|
|
@end
|
|
|
|
|
2013-04-19 03:40:40 +04:00
|
|
|
@interface NSView (Undocumented)
|
|
|
|
|
2013-12-17 20:11:13 +04:00
|
|
|
// Draws the title string of a window.
|
|
|
|
// Present on NSThemeFrame since at least 10.6.
|
|
|
|
// _drawTitleBar is somewhat complex, and has changed over the years
|
|
|
|
// since OS X 10.6. But in that time it's never done anything that
|
|
|
|
// would break when called outside of -[NSView drawRect:] (which we
|
|
|
|
// sometimes do), or whose output can't be redirected to a
|
|
|
|
// CGContextRef object (which we also sometimes do). This is likely
|
|
|
|
// to remain true for the indefinite future. However we should
|
|
|
|
// check _drawTitleBar in each new major version of OS X. For more
|
|
|
|
// information see bug 877767.
|
|
|
|
- (void)_drawTitleBar:(NSRect)aRect;
|
|
|
|
|
2013-04-19 03:40:40 +04:00
|
|
|
// Returns an NSRect that is the bounding box for all an NSView's dirty
|
|
|
|
// rectangles (ones that need to be redrawn). The full list of dirty
|
|
|
|
// rectangles can be obtained by calling -[NSView _dirtyRegion] and then
|
|
|
|
// calling -[NSRegion getRects:count:] on what it returns. Both these
|
|
|
|
// methods have been present in the same form since at least OS X 10.5.
|
|
|
|
// Unlike -[NSView getRectsBeingDrawn:count:], these methods can be called
|
|
|
|
// outside a call to -[NSView drawRect:].
|
|
|
|
- (NSRect)_dirtyRect;
|
|
|
|
|
2013-06-13 01:42:00 +04:00
|
|
|
// Undocumented method of one or more of NSFrameView's subclasses. Called
|
|
|
|
// when one or more of the titlebar buttons needs to be repositioned, to
|
|
|
|
// disappear, or to reappear (say if the window's style changes). If
|
|
|
|
// 'redisplay' is true, the entire titlebar (the window's top 22 pixels) is
|
|
|
|
// marked as needing redisplay. This method has been present in the same
|
|
|
|
// format since at least OS X 10.5.
|
|
|
|
- (void)_tileTitlebarAndRedisplay:(BOOL)redisplay;
|
|
|
|
|
2014-10-14 02:05:59 +04:00
|
|
|
// The following undocumented methods are used to work around bug 1069658,
|
|
|
|
// which is an Apple bug or design flaw that effects Yosemite. None of them
|
|
|
|
// were present prior to Yosemite (OS X 10.10).
|
|
|
|
- (NSView*)titlebarView; // Method of NSThemeFrame
|
|
|
|
- (NSView*)titlebarContainerView; // Method of NSThemeFrame
|
|
|
|
- (BOOL)transparent; // Method of NSTitlebarView and NSTitlebarContainerView
|
|
|
|
- (void)setTransparent:(BOOL)transparent; // Method of NSTitlebarView and
|
|
|
|
// NSTitlebarContainerView
|
|
|
|
|
2017-02-14 00:28:28 +03:00
|
|
|
// Available since 10.7.4:
|
|
|
|
- (void)viewDidChangeBackingProperties;
|
2013-04-19 03:40:40 +04:00
|
|
|
@end
|
|
|
|
|
2006-12-19 23:47:53 +03:00
|
|
|
@interface ChildView : NSView <
|
2006-09-11 19:47:35 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2006-12-19 23:47:53 +03:00
|
|
|
mozAccessible,
|
2006-02-22 04:31:14 +03:00
|
|
|
#endif
|
2016-12-20 22:33:08 +03:00
|
|
|
mozView,
|
|
|
|
NSTextInputClient,
|
|
|
|
NSDraggingSource,
|
|
|
|
NSDraggingDestination,
|
|
|
|
NSPasteboardItemDataProvider> {
|
2005-09-30 04:59:29 +04:00
|
|
|
@private
|
2006-03-29 04:49:15 +04:00
|
|
|
// the nsChildView that created the view. It retains this NSView, so
|
|
|
|
// the link back to it must be weak.
|
2001-11-06 18:35:24 +03:00
|
|
|
nsChildView* mGeckoChild;
|
2009-08-27 04:29:47 +04:00
|
|
|
|
2011-05-08 14:19:23 +04:00
|
|
|
// Text input handler for mGeckoChild and us. Note that this is a weak
|
|
|
|
// reference. Ideally, this should be a strong reference but a ChildView
|
|
|
|
// object can live longer than the mGeckoChild that owns it. And if
|
|
|
|
// mTextInputHandler were a strong reference, this would make it difficult
|
|
|
|
// for Gecko's leak detector to detect leaked TextInputHandler objects.
|
|
|
|
// This is initialized by [mozView installTextInputHandler:aHandler] and
|
|
|
|
// cleared by [mozView uninstallTextInputHandler].
|
|
|
|
mozilla::widget::TextInputHandler* mTextInputHandler; // [WEAK]
|
|
|
|
|
2008-04-07 03:52:05 +04:00
|
|
|
// when mouseDown: is called, we store its event here (strong)
|
|
|
|
NSEvent* mLastMouseDownEvent;
|
2010-07-16 16:48:02 +04:00
|
|
|
|
2015-02-20 19:37:02 +03:00
|
|
|
// Needed for IME support in e10s mode. Strong.
|
|
|
|
NSEvent* mLastKeyDownEvent;
|
|
|
|
|
2010-07-16 16:48:02 +04:00
|
|
|
// Whether the last mouse down event was blocked from Gecko.
|
|
|
|
BOOL mBlockedLastMouseDown;
|
|
|
|
|
|
|
|
// when acceptsFirstMouse: is called, we store the event here (strong)
|
|
|
|
NSEvent* mClickThroughMouseDownEvent;
|
|
|
|
|
2013-08-17 01:17:40 +04:00
|
|
|
// WheelStart/Stop events should always come in pairs. This BOOL records the
|
|
|
|
// last received event so that, when we receive one of the events, we make sure
|
|
|
|
// to send its pair event first, in case we didn't yet for any reason.
|
|
|
|
BOOL mExpectingWheelStop;
|
|
|
|
|
2016-06-02 07:58:44 +03:00
|
|
|
// Set to YES when our GL surface has been updated and we need to call
|
2019-08-16 04:10:11 +03:00
|
|
|
// updateGLContext on the compositor thread before we composite.
|
|
|
|
// Accesses from different threads are synchronized via mGLContext's
|
|
|
|
// CGLContextObj lock.
|
2019-08-16 04:12:18 +03:00
|
|
|
// Always NO if StaticPrefs::gfx_core_animation_enabled_AtStartup() is true.
|
2016-06-02 07:58:44 +03:00
|
|
|
BOOL mNeedsGLUpdate;
|
|
|
|
|
2006-10-26 02:45:22 +04:00
|
|
|
// Holds our drag service across multiple drag calls. The reference to the
|
|
|
|
// service is obtained when the mouse enters the view and is released when
|
|
|
|
// the mouse exits or there is a drop. This prevents us from having to
|
|
|
|
// re-establish the connection to the service manager many times per second
|
|
|
|
// when handling |draggingUpdated:| messages.
|
|
|
|
nsIDragService* mDragService;
|
2010-03-20 18:05:47 +03:00
|
|
|
|
2019-08-16 04:10:11 +03:00
|
|
|
// The NSOpenGLContext that is attached to our mPixelHostingView.
|
2019-08-16 04:12:18 +03:00
|
|
|
// Always null if StaticPrefs::gfx_core_animation_enabled_AtStartup() is true.
|
2010-06-18 13:22:01 +04:00
|
|
|
NSOpenGLContext* mGLContext;
|
2010-04-28 02:29:29 +04:00
|
|
|
|
2017-09-27 22:21:42 +03:00
|
|
|
// Gestures support
|
2008-10-24 00:15:20 +04:00
|
|
|
//
|
2017-10-01 06:30:01 +03:00
|
|
|
// mGestureState is used to detect when Cocoa has called both
|
|
|
|
// magnifyWithEvent and rotateWithEvent within the same
|
|
|
|
// beginGestureWithEvent and endGestureWithEvent sequence. We
|
|
|
|
// discard the spurious gesture event so as not to confuse Gecko.
|
|
|
|
//
|
2008-10-24 00:15:20 +04:00
|
|
|
// mCumulativeMagnification keeps track of the total amount of
|
|
|
|
// magnification peformed during a magnify gesture so that we can
|
|
|
|
// send that value with the final MozMagnifyGesture event.
|
|
|
|
//
|
|
|
|
// mCumulativeRotation keeps track of the total amount of rotation
|
|
|
|
// performed during a rotate gesture so we can send that value with
|
|
|
|
// the final MozRotateGesture event.
|
|
|
|
enum {
|
|
|
|
eGestureState_None,
|
|
|
|
eGestureState_StartGesture,
|
2017-10-01 06:30:01 +03:00
|
|
|
eGestureState_MagnifyGesture,
|
2013-04-23 01:41:50 +04:00
|
|
|
eGestureState_RotateGesture
|
2008-10-24 00:15:20 +04:00
|
|
|
} mGestureState;
|
|
|
|
float mCumulativeMagnification;
|
|
|
|
float mCumulativeRotation;
|
2011-02-04 00:12:33 +03:00
|
|
|
|
2013-02-09 04:52:12 +04:00
|
|
|
#ifdef __LP64__
|
2013-04-09 23:44:01 +04:00
|
|
|
// Support for fluid swipe tracking.
|
2013-09-23 17:02:55 +04:00
|
|
|
BOOL* mCancelSwipeAnimation;
|
2011-08-11 21:42:23 +04:00
|
|
|
#endif
|
2012-01-19 18:45:37 +04:00
|
|
|
|
|
|
|
// Whether this uses off-main-thread compositing.
|
|
|
|
BOOL mUsingOMTCompositor;
|
2013-05-23 18:49:17 +04:00
|
|
|
|
|
|
|
// The mask image that's used when painting into the titlebar using basic
|
|
|
|
// CGContext painting (i.e. non-accelerated).
|
2019-08-16 04:12:18 +03:00
|
|
|
// Always null if StaticPrefs::gfx_core_animation_enabled_AtStartup() is true.
|
2013-05-23 18:49:17 +04:00
|
|
|
CGImageRef mTopLeftCornerMask;
|
2016-11-16 06:50:37 +03:00
|
|
|
|
2019-02-13 20:50:12 +03:00
|
|
|
// Subviews of self, which act as container views for vibrancy views and
|
|
|
|
// non-draggable views.
|
|
|
|
NSView* mVibrancyViewsContainer; // [STRONG]
|
|
|
|
NSView* mNonDraggableViewsContainer; // [STRONG]
|
|
|
|
|
2019-08-16 04:11:03 +03:00
|
|
|
// The view that does our drawing. Always non-null.
|
2019-08-16 04:12:18 +03:00
|
|
|
// This is a subview of self so that it can be ordered on top of mVibrancyViewsContainer.
|
|
|
|
// Drawing in this view can be performed in different ways:
|
|
|
|
// If StaticPrefs::gfx_core_animation_enabled_AtStartup() is false, there are two cases:
|
2019-08-16 04:11:03 +03:00
|
|
|
// If mUsingOMTCompositor is false, drawing is performed on the main thread
|
|
|
|
// inside the view's drawRect handler. If mUsingOMTCompositor is true,
|
|
|
|
// mGLContext will be non-null and will be associated with mPixelHostingView,
|
|
|
|
// and rendering will be performed on the compositor thread into mGLContext's
|
|
|
|
// primary framebuffer.
|
2019-02-13 20:50:41 +03:00
|
|
|
PixelHostingView* mPixelHostingView;
|
|
|
|
|
2016-11-16 06:50:37 +03:00
|
|
|
// Last pressure stage by trackpad's force click
|
|
|
|
NSInteger mLastPressureStage;
|
2002-12-13 11:43:18 +03:00
|
|
|
}
|
2002-04-27 04:19:49 +04:00
|
|
|
|
2008-12-15 23:56:29 +03:00
|
|
|
// class initialization
|
|
|
|
+ (void)initialize;
|
|
|
|
|
2013-02-06 01:40:34 +04:00
|
|
|
+ (void)registerViewForDraggedTypes:(NSView*)aView;
|
|
|
|
|
2006-10-26 02:45:22 +04:00
|
|
|
// these are sent to the first responder when the window key status changes
|
2005-06-26 07:25:52 +04:00
|
|
|
- (void)viewsWindowDidBecomeKey;
|
|
|
|
- (void)viewsWindowDidResignKey;
|
2007-05-30 22:25:44 +04:00
|
|
|
|
|
|
|
// Stop NSView hierarchy being changed during [ChildView drawRect:]
|
|
|
|
- (void)delayedTearDown;
|
2008-01-17 19:58:29 +03:00
|
|
|
|
2009-09-23 06:31:37 +04:00
|
|
|
- (void)handleMouseMoved:(NSEvent*)aEvent;
|
|
|
|
|
|
|
|
- (void)sendMouseEnterOrExitEvent:(NSEvent*)aEvent
|
|
|
|
enter:(BOOL)aEnter
|
2016-05-12 05:32:53 +03:00
|
|
|
exitFrom:(mozilla::WidgetMouseEvent::ExitFrom)aExitFrom;
|
2009-09-23 06:31:37 +04:00
|
|
|
|
2013-10-09 18:39:22 +04:00
|
|
|
- (void)updateGLContext;
|
|
|
|
- (void)_surfaceNeedsUpdate:(NSNotification*)notification;
|
2010-04-28 02:29:29 +04:00
|
|
|
|
2013-10-09 18:39:22 +04:00
|
|
|
- (bool)preRender:(NSOpenGLContext*)aGLContext;
|
2013-10-09 18:39:23 +04:00
|
|
|
- (void)postRender:(NSOpenGLContext*)aGLContext;
|
2012-01-19 18:45:37 +04:00
|
|
|
|
2019-02-13 20:50:12 +03:00
|
|
|
- (NSView*)vibrancyViewsContainer;
|
|
|
|
- (NSView*)nonDraggableViewsContainer;
|
2019-02-13 20:50:41 +03:00
|
|
|
- (NSView*)pixelHostingView;
|
2019-02-13 20:50:12 +03:00
|
|
|
|
2013-05-23 18:49:17 +04:00
|
|
|
- (BOOL)isCoveringTitlebar;
|
|
|
|
|
2015-08-26 19:59:17 +03:00
|
|
|
- (void)viewWillStartLiveResize;
|
|
|
|
- (void)viewDidEndLiveResize;
|
|
|
|
|
2015-02-05 01:25:18 +03:00
|
|
|
- (NSColor*)vibrancyFillColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType;
|
2014-10-07 18:18:01 +04:00
|
|
|
|
2017-09-27 22:21:42 +03:00
|
|
|
/*
|
|
|
|
* Gestures support
|
|
|
|
*
|
|
|
|
* The prototypes swipeWithEvent, beginGestureWithEvent, smartMagnifyWithEvent,
|
|
|
|
* rotateWithEvent and endGestureWithEvent were obtained from the following
|
|
|
|
* links:
|
|
|
|
* https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSResponder_Class/Reference/Reference.html
|
|
|
|
* https://developer.apple.com/library/mac/#releasenotes/Cocoa/AppKit.html
|
|
|
|
*/
|
2008-10-24 00:15:20 +04:00
|
|
|
- (void)swipeWithEvent:(NSEvent*)anEvent;
|
|
|
|
- (void)beginGestureWithEvent:(NSEvent*)anEvent;
|
2017-10-01 06:30:01 +03:00
|
|
|
- (void)magnifyWithEvent:(NSEvent*)anEvent;
|
2013-04-29 19:24:26 +04:00
|
|
|
- (void)smartMagnifyWithEvent:(NSEvent*)anEvent;
|
2008-10-24 00:15:20 +04:00
|
|
|
- (void)rotateWithEvent:(NSEvent*)anEvent;
|
|
|
|
- (void)endGestureWithEvent:(NSEvent*)anEvent;
|
2013-04-10 22:38:26 +04:00
|
|
|
|
2013-08-17 01:17:40 +04:00
|
|
|
- (void)scrollWheel:(NSEvent*)anEvent;
|
|
|
|
|
2012-01-19 18:45:37 +04:00
|
|
|
- (void)setUsingOMTCompositor:(BOOL)aUseOMTC;
|
2015-02-20 19:37:02 +03:00
|
|
|
|
|
|
|
- (NSEvent*)lastKeyDownEvent;
|
2017-05-16 05:59:35 +03:00
|
|
|
|
|
|
|
+ (uint32_t)sUniqueKeyEventId;
|
|
|
|
|
|
|
|
+ (NSMutableDictionary*)sNativeKeyEventsMap;
|
2001-11-06 18:35:24 +03:00
|
|
|
@end
|
|
|
|
|
2009-09-23 06:31:37 +04:00
|
|
|
class ChildViewMouseTracker {
|
|
|
|
public:
|
|
|
|
static void MouseMoved(NSEvent* aEvent);
|
2011-08-18 02:30:52 +04:00
|
|
|
static void MouseScrolled(NSEvent* aEvent);
|
2009-09-23 06:31:37 +04:00
|
|
|
static void OnDestroyView(ChildView* aView);
|
2011-08-08 18:43:13 +04:00
|
|
|
static void OnDestroyWindow(NSWindow* aWindow);
|
2010-07-16 16:48:02 +04:00
|
|
|
static BOOL WindowAcceptsEvent(NSWindow* aWindow, NSEvent* aEvent, ChildView* aView,
|
|
|
|
BOOL isClickThrough = NO);
|
2011-08-08 18:43:13 +04:00
|
|
|
static void MouseExitedWindow(NSEvent* aEvent);
|
|
|
|
static void MouseEnteredWindow(NSEvent* aEvent);
|
2013-09-18 03:36:03 +04:00
|
|
|
static void ReEvaluateMouseEnterState(NSEvent* aEvent = nil, ChildView* aOldView = nil);
|
2011-08-13 18:25:39 +04:00
|
|
|
static void ResendLastMouseMoveEvent();
|
2010-01-22 23:57:04 +03:00
|
|
|
static ChildView* ViewForEvent(NSEvent* aEvent);
|
2009-09-23 06:31:37 +04:00
|
|
|
|
|
|
|
static ChildView* sLastMouseEventView;
|
2011-08-13 18:25:39 +04:00
|
|
|
static NSEvent* sLastMouseMoveEvent;
|
2011-08-08 18:43:13 +04:00
|
|
|
static NSWindow* sWindowUnderMouse;
|
2011-08-18 02:30:52 +04:00
|
|
|
static NSPoint sLastScrollEventScreenLocation;
|
2009-09-23 06:31:37 +04:00
|
|
|
};
|
|
|
|
|
2001-11-06 18:35:24 +03:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// nsChildView
|
|
|
|
//
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2017-07-05 03:01:45 +03:00
|
|
|
class nsChildView final : public nsBaseWidget {
|
2001-11-06 18:35:24 +03:00
|
|
|
private:
|
|
|
|
typedef nsBaseWidget Inherited;
|
2016-07-20 14:37:00 +03:00
|
|
|
typedef mozilla::layers::IAPZCTreeManager IAPZCTreeManager;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
|
|
|
public:
|
2014-07-09 01:23:18 +04:00
|
|
|
nsChildView();
|
|
|
|
|
2001-11-15 01:29:25 +03:00
|
|
|
// nsIWidget interface
|
2016-08-19 02:03:17 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
|
|
|
const LayoutDeviceIntRect& aRect,
|
|
|
|
nsWidgetInitData* aInitData = nullptr) override;
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2016-08-10 03:04:11 +03:00
|
|
|
virtual void Destroy() override;
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2016-12-21 03:12:54 +03:00
|
|
|
virtual void Show(bool aState) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsVisible() const override;
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2016-12-16 02:54:11 +03:00
|
|
|
virtual void SetParent(nsIWidget* aNewParent) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIWidget* GetParent(void) override;
|
|
|
|
virtual float GetDPI() override;
|
2008-02-20 10:40:04 +03:00
|
|
|
|
2016-12-19 12:54:03 +03:00
|
|
|
virtual void Move(double aX, double aY) override;
|
|
|
|
virtual void Resize(double aWidth, double aHeight, bool aRepaint) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2016-12-19 12:54:16 +03:00
|
|
|
virtual void Enable(bool aState) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsEnabled() const override;
|
2019-06-01 01:13:56 +03:00
|
|
|
virtual void SetFocus(Raise) override;
|
2016-08-19 02:03:04 +03:00
|
|
|
virtual LayoutDeviceIntRect GetBounds() override;
|
|
|
|
virtual LayoutDeviceIntRect GetClientBounds() override;
|
|
|
|
virtual LayoutDeviceIntRect GetScreenBounds() override;
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2018-04-10 00:31:49 +03:00
|
|
|
// Refresh mBounds with up-to-date values from [mView frame].
|
|
|
|
// Only called if this nsChildView is the popup content view of a popup window.
|
|
|
|
// For popup windows, the nsIWidget interface to Gecko is provided by
|
|
|
|
// nsCocoaWindow, not by nsChildView. So nsCocoaWindow manages resize requests
|
|
|
|
// from Gecko, fires resize events, and resizes the native NSWindow and NSView.
|
|
|
|
void UpdateBoundsFromView();
|
|
|
|
|
2012-09-29 15:36:09 +04:00
|
|
|
// Returns the "backing scale factor" of the view's window, which is the
|
|
|
|
// ratio of pixels in the window's backing store to Cocoa points. Prior to
|
|
|
|
// HiDPI support in OS X 10.7, this was always 1.0, but in HiDPI mode it
|
|
|
|
// will be 2.0 (and might potentially other values as screen resolutions
|
|
|
|
// evolve). This gives the relationship between what Gecko calls "device
|
|
|
|
// pixels" and the Cocoa "points" coordinate system.
|
2014-08-28 04:15:29 +04:00
|
|
|
CGFloat BackingScaleFactor() const;
|
2012-09-29 15:36:09 +04:00
|
|
|
|
2018-02-06 09:46:57 +03:00
|
|
|
mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScale() final {
|
2015-12-04 19:58:05 +03:00
|
|
|
return mozilla::DesktopToLayoutDeviceScale(BackingScaleFactor());
|
|
|
|
}
|
|
|
|
|
2012-10-16 23:41:20 +04:00
|
|
|
// Call if the window's backing scale factor changes - i.e., it is moved
|
|
|
|
// between HiDPI and non-HiDPI screens
|
|
|
|
void BackingScaleFactorChanged();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual double GetDefaultScaleInternal() override;
|
2012-09-29 15:36:09 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual int32_t RoundsWidgetCoordinatesTo() override;
|
2013-07-30 20:22:41 +04:00
|
|
|
|
2016-12-20 01:55:32 +03:00
|
|
|
virtual void Invalidate(const LayoutDeviceIntRect& aRect) override;
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType) override;
|
|
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
2019-04-29 20:04:08 +03:00
|
|
|
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override { return false; }
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool ConvertStatus(nsEventStatus aStatus) {
|
2006-03-27 15:32:55 +04:00
|
|
|
return aStatus == nsEventStatus_eConsumeNoDefault;
|
|
|
|
}
|
2016-12-21 03:18:40 +03:00
|
|
|
virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override;
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2016-10-07 12:08:32 +03:00
|
|
|
virtual bool WidgetTypeSupportsAcceleration() override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool ShouldUseOffMainThreadCompositing() override;
|
2006-03-18 02:35:39 +03:00
|
|
|
|
2019-01-15 16:56:52 +03:00
|
|
|
virtual void SetCursor(nsCursor aDefaultCursor, imgIContainer* aCursor, uint32_t aHotspotX,
|
|
|
|
uint32_t aHotspotY) override;
|
2012-01-19 18:45:37 +04:00
|
|
|
|
2016-12-21 03:13:08 +03:00
|
|
|
virtual nsresult SetTitle(const nsAString& title) override;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2016-12-16 02:54:02 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override;
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool HasPendingInputEvent() override;
|
2009-04-22 03:53:52 +04:00
|
|
|
|
2017-05-16 05:59:35 +03:00
|
|
|
bool SendEventToNativeMenuSystem(NSEvent* aEvent);
|
|
|
|
virtual void PostHandleKeyEvent(mozilla::WidgetKeyboardEvent* aEvent) override;
|
2016-12-21 07:58:09 +03:00
|
|
|
virtual nsresult ActivateNativeMenuItemAt(const nsAString& indexString) override;
|
|
|
|
virtual nsresult ForceUpdateNativeMenuAt(const nsAString& indexString) override;
|
2016-12-21 03:13:08 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult GetSelectionAsPlaintext(nsAString& aResult) override;
|
2008-06-28 11:55:30 +04:00
|
|
|
|
2016-12-21 07:27:20 +03:00
|
|
|
virtual void SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction) override;
|
|
|
|
virtual InputContext GetInputContext() override;
|
2016-03-16 07:47:49 +03:00
|
|
|
virtual TextEventDispatcherListener* GetNativeTextEventDispatcherListener() override;
|
2016-12-16 02:54:02 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) override;
|
2017-05-19 11:49:41 +03:00
|
|
|
virtual void GetEditCommands(NativeKeyBindingsType aType,
|
|
|
|
const mozilla::WidgetKeyboardEvent& aEvent,
|
|
|
|
nsTArray<mozilla::CommandInt>& aCommands) override;
|
|
|
|
void GetEditCommandsRemapped(NativeKeyBindingsType aType,
|
|
|
|
const mozilla::WidgetKeyboardEvent& aEvent,
|
|
|
|
nsTArray<mozilla::CommandInt>& aCommands, uint32_t aGeckoKeyCode,
|
|
|
|
uint32_t aCocoaKeyCode);
|
2008-07-14 06:56:18 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsTransparencyMode GetTransparencyMode() override;
|
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
|
2009-09-23 06:31:37 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout, int32_t aNativeKeyCode,
|
2009-09-23 06:31:37 +04:00
|
|
|
uint32_t aModifierFlags, const nsAString& aCharacters,
|
2015-04-14 18:36:36 +03:00
|
|
|
const nsAString& aUnmodifiedCharacters,
|
|
|
|
nsIObserver* aObserver) override;
|
2009-09-23 06:31:37 +04:00
|
|
|
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint, uint32_t aNativeMessage,
|
2015-04-14 18:36:36 +03:00
|
|
|
uint32_t aModifierFlags,
|
|
|
|
nsIObserver* aObserver) override;
|
2012-04-12 01:55:21 +04:00
|
|
|
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
2015-04-14 18:36:36 +03:00
|
|
|
nsIObserver* aObserver) override {
|
|
|
|
return SynthesizeNativeMouseEvent(aPoint, NSMouseMoved, 0, aObserver);
|
|
|
|
}
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
2015-05-05 21:45:11 +03:00
|
|
|
uint32_t aNativeMessage, double aDeltaX,
|
|
|
|
double aDeltaY, double aDeltaZ,
|
|
|
|
uint32_t aModifierFlags,
|
|
|
|
uint32_t aAdditionalFlags,
|
|
|
|
nsIObserver* aObserver) override;
|
2016-07-26 03:33:09 +03:00
|
|
|
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId, TouchPointerState aPointerState,
|
|
|
|
LayoutDeviceIntPoint aPoint, double aPointerPressure,
|
|
|
|
uint32_t aPointerOrientation,
|
|
|
|
nsIObserver* aObserver) override;
|
2012-04-12 01:55:21 +04:00
|
|
|
|
2001-11-15 01:29:25 +03:00
|
|
|
// Mac specific methods
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2013-10-02 07:46:03 +04:00
|
|
|
virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent& event);
|
2012-08-15 22:52:42 +04:00
|
|
|
|
2013-02-26 01:18:48 +04:00
|
|
|
void WillPaintWindow();
|
2015-12-03 08:45:41 +03:00
|
|
|
bool PaintWindow(LayoutDeviceIntRegion aRegion);
|
2019-04-29 20:04:11 +03:00
|
|
|
bool PaintWindowInDrawTarget(mozilla::gfx::DrawTarget* aDT, const LayoutDeviceIntRegion& aRegion,
|
|
|
|
const mozilla::gfx::IntSize& aSurfaceSize);
|
2016-05-31 21:35:54 +03:00
|
|
|
bool PaintWindowInContext(CGContextRef aContext, const LayoutDeviceIntRegion& aRegion,
|
|
|
|
mozilla::gfx::IntSize aSurfaceSize);
|
2012-08-15 22:52:42 +04:00
|
|
|
|
2006-09-11 19:47:35 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-11-18 06:01:44 +04:00
|
|
|
already_AddRefed<mozilla::a11y::Accessible> GetDocumentAccessible();
|
2006-09-11 19:47:35 +04:00
|
|
|
#endif
|
2006-02-22 04:31:14 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void CreateCompositor() override;
|
|
|
|
virtual void PrepareWindowEffects() override;
|
|
|
|
virtual void CleanupWindowEffects() override;
|
2017-06-22 01:58:41 +03:00
|
|
|
|
|
|
|
virtual void AddWindowOverlayWebRenderCommands(
|
|
|
|
mozilla::layers::WebRenderBridgeChild* aWrBridge, mozilla::wr::DisplayListBuilder& aBuilder,
|
2017-09-14 19:48:55 +03:00
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResourceUpdates) override;
|
2017-06-22 01:58:41 +03:00
|
|
|
|
2016-11-08 05:16:52 +03:00
|
|
|
virtual bool PreRender(mozilla::widget::WidgetRenderingContext* aContext) override;
|
2019-07-17 23:47:16 +03:00
|
|
|
bool PreRenderImpl(mozilla::widget::WidgetRenderingContext* aContext);
|
2016-11-08 05:16:52 +03:00
|
|
|
virtual void PostRender(mozilla::widget::WidgetRenderingContext* aContext) override;
|
|
|
|
virtual void DrawWindowOverlay(mozilla::widget::WidgetRenderingContext* aManager,
|
2015-11-19 06:10:38 +03:00
|
|
|
LayoutDeviceIntRect aRect) override;
|
2006-12-19 23:47:53 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
|
2011-01-11 16:03:16 +03:00
|
|
|
|
2015-11-26 08:42:59 +03:00
|
|
|
virtual void UpdateWindowDraggingRegion(const LayoutDeviceIntRegion& aRegion) override;
|
2016-07-11 23:15:07 +03:00
|
|
|
LayoutDeviceIntRegion GetNonDraggableRegion() { return mNonDraggableRegion.Region(); }
|
2014-09-18 12:52:30 +04:00
|
|
|
|
2015-08-09 03:05:18 +03:00
|
|
|
virtual void ReportSwipeStarted(uint64_t aInputBlockId, bool aStartSwipe) override;
|
|
|
|
|
2016-04-04 11:14:36 +03:00
|
|
|
virtual void LookUpDictionary(const nsAString& aText,
|
|
|
|
const nsTArray<mozilla::FontRange>& aFontRangeArray,
|
|
|
|
const bool aIsVertical,
|
|
|
|
const LayoutDeviceIntPoint& aPoint) override;
|
|
|
|
|
2009-04-23 19:54:50 +04:00
|
|
|
void ResetParent();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool DoHasPendingInputEvent();
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t GetCurrentInputEventCount();
|
2009-04-22 03:53:52 +04:00
|
|
|
static void UpdateCurrentInputEventCount();
|
2009-07-22 04:44:55 +04:00
|
|
|
|
2009-10-01 06:52:50 +04:00
|
|
|
NSView<mozView>* GetEditorView();
|
|
|
|
|
2017-08-11 07:43:26 +03:00
|
|
|
nsCocoaWindow* GetXULWindowWidget() const;
|
2010-11-16 00:12:50 +03:00
|
|
|
|
2016-08-25 06:43:26 +03:00
|
|
|
virtual void ReparentNativeWidget(nsIWidget* aNewParent) override;
|
2011-02-24 07:48:12 +03:00
|
|
|
|
|
|
|
mozilla::widget::TextInputHandler* GetTextInputHandler() { return mTextInputHandler; }
|
|
|
|
|
2015-02-05 01:25:18 +03:00
|
|
|
NSColor* VibrancyFillColorForThemeGeometryType(nsITheme::ThemeGeometryType aThemeGeometryType);
|
|
|
|
NSColor* VibrancyFontSmoothingBackgroundColorForThemeGeometryType(
|
|
|
|
nsITheme::ThemeGeometryType aThemeGeometryType);
|
2013-05-23 18:49:17 +04:00
|
|
|
|
2012-09-29 15:36:09 +04:00
|
|
|
// unit conversion convenience functions
|
2014-08-28 04:15:29 +04:00
|
|
|
int32_t CocoaPointsToDevPixels(CGFloat aPts) const {
|
2013-05-22 13:48:47 +04:00
|
|
|
return nsCocoaUtils::CocoaPointsToDevPixels(aPts, BackingScaleFactor());
|
|
|
|
}
|
2015-11-19 09:34:20 +03:00
|
|
|
LayoutDeviceIntPoint CocoaPointsToDevPixels(const NSPoint& aPt) const {
|
2012-09-29 15:36:09 +04:00
|
|
|
return nsCocoaUtils::CocoaPointsToDevPixels(aPt, BackingScaleFactor());
|
|
|
|
}
|
2017-04-15 18:02:09 +03:00
|
|
|
LayoutDeviceIntPoint CocoaPointsToDevPixelsRoundDown(const NSPoint& aPt) const {
|
|
|
|
return nsCocoaUtils::CocoaPointsToDevPixelsRoundDown(aPt, BackingScaleFactor());
|
|
|
|
}
|
2015-11-19 06:10:38 +03:00
|
|
|
LayoutDeviceIntRect CocoaPointsToDevPixels(const NSRect& aRect) const {
|
2012-09-29 15:36:09 +04:00
|
|
|
return nsCocoaUtils::CocoaPointsToDevPixels(aRect, BackingScaleFactor());
|
|
|
|
}
|
2014-08-28 04:15:29 +04:00
|
|
|
CGFloat DevPixelsToCocoaPoints(int32_t aPixels) const {
|
2012-09-29 15:36:09 +04:00
|
|
|
return nsCocoaUtils::DevPixelsToCocoaPoints(aPixels, BackingScaleFactor());
|
|
|
|
}
|
2015-11-19 06:10:38 +03:00
|
|
|
NSRect DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect) const {
|
2012-09-29 15:36:09 +04:00
|
|
|
return nsCocoaUtils::DevPixelsToCocoaPoints(aRect, BackingScaleFactor());
|
|
|
|
}
|
|
|
|
|
2016-02-19 04:57:29 +03:00
|
|
|
already_AddRefed<mozilla::gfx::DrawTarget> StartRemoteDrawingInRegion(
|
|
|
|
LayoutDeviceIntRegion& aInvalidRegion, mozilla::layers::BufferMode* aBufferMode) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
void EndRemoteDrawing() override;
|
|
|
|
void CleanupRemoteDrawing() override;
|
2015-07-13 17:46:48 +03:00
|
|
|
bool InitCompositor(mozilla::layers::Compositor* aCompositor) override;
|
2013-07-09 08:21:05 +04:00
|
|
|
|
2016-12-16 02:55:18 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
|
|
|
|
int32_t aPanelX, int32_t aPanelY,
|
|
|
|
nsString& aCommitted) override;
|
2015-02-20 19:37:02 +03:00
|
|
|
|
2016-08-25 06:43:27 +03:00
|
|
|
virtual void SetPluginFocused(bool& aFocused) override;
|
2015-02-20 19:37:02 +03:00
|
|
|
|
|
|
|
bool IsPluginFocused() { return mPluginFocused; }
|
|
|
|
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
2015-04-29 18:41:19 +03:00
|
|
|
|
2015-08-29 00:30:16 +03:00
|
|
|
void DispatchAPZWheelInputEvent(mozilla::InputData& aEvent, bool aCanTriggerSwipe);
|
2018-05-15 23:03:24 +03:00
|
|
|
nsEventStatus DispatchAPZInputEvent(mozilla::InputData& aEvent);
|
2015-08-24 02:50:29 +03:00
|
|
|
|
2015-08-27 23:07:59 +03:00
|
|
|
void SwipeFinished();
|
|
|
|
|
2018-09-15 04:00:07 +03:00
|
|
|
nsresult SetPrefersReducedMotionOverrideForTest(bool aValue) override;
|
|
|
|
nsresult ResetPrefersReducedMotionOverrideForTest() override;
|
|
|
|
|
2001-11-06 18:35:24 +03:00
|
|
|
protected:
|
2014-07-09 01:23:18 +04:00
|
|
|
virtual ~nsChildView();
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2012-08-15 22:52:42 +04:00
|
|
|
void ReportMoveEvent();
|
|
|
|
void ReportSizeEvent();
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2005-09-30 04:59:29 +04:00
|
|
|
void TearDownView();
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<nsIWidget> AllocateChildPopupWidget() override {
|
2018-08-22 06:51:46 +03:00
|
|
|
return nsIWidget::CreateTopLevelWindow();
|
2010-08-20 23:29:02 +04:00
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
void ConfigureAPZCTreeManager() override;
|
2015-04-07 23:53:41 +03:00
|
|
|
void ConfigureAPZControllerThread() override;
|
2014-12-15 12:47:15 +03:00
|
|
|
|
2015-11-19 06:10:38 +03:00
|
|
|
void DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect);
|
2013-07-09 08:21:05 +04:00
|
|
|
|
2013-05-23 18:49:17 +04:00
|
|
|
// Overlay drawing functions for OpenGL drawing
|
2015-11-19 06:10:38 +03:00
|
|
|
void DrawWindowOverlay(mozilla::layers::GLManager* aManager, LayoutDeviceIntRect aRect);
|
|
|
|
void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager,
|
|
|
|
const LayoutDeviceIntRect& aRect);
|
|
|
|
void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager);
|
2013-05-23 18:49:17 +04:00
|
|
|
|
2013-11-27 09:49:45 +04:00
|
|
|
// Redraw the contents of mTitlebarCGContext on the main thread, as
|
2013-05-23 18:49:17 +04:00
|
|
|
// determined by mDirtyTitlebarRegion.
|
2013-11-27 09:49:45 +04:00
|
|
|
void UpdateTitlebarCGContext();
|
2013-05-23 18:49:17 +04:00
|
|
|
|
2015-11-19 06:10:38 +03:00
|
|
|
LayoutDeviceIntRect RectContainingTitlebarControls();
|
2014-08-28 04:15:33 +04:00
|
|
|
void UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries);
|
|
|
|
mozilla::VibrancyManager& EnsureVibrancyManager();
|
2013-03-27 19:49:02 +04:00
|
|
|
|
2013-02-26 01:18:48 +04:00
|
|
|
nsIWidget* GetWidgetForListenerEvents();
|
|
|
|
|
2015-08-12 06:12:57 +03:00
|
|
|
struct SwipeInfo {
|
|
|
|
bool wantsSwipe;
|
|
|
|
uint32_t allowedDirections;
|
|
|
|
};
|
|
|
|
|
|
|
|
SwipeInfo SendMayStartSwipe(const mozilla::PanGestureInput& aSwipeStartEvent);
|
|
|
|
void TrackScrollEventAsSwipe(const mozilla::PanGestureInput& aSwipeStartEvent,
|
|
|
|
uint32_t aAllowedDirections);
|
2015-08-29 00:30:16 +03:00
|
|
|
|
2005-09-30 04:59:29 +04:00
|
|
|
protected:
|
2019-02-13 14:14:02 +03:00
|
|
|
ChildView* mView; // my parallel cocoa view, [STRONG]
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::widget::TextInputHandler> mTextInputHandler;
|
2011-11-27 15:51:52 +04:00
|
|
|
InputContext mInputContext;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2019-02-13 14:14:02 +03:00
|
|
|
NSView* mParentView;
|
2002-12-13 11:43:18 +03:00
|
|
|
nsIWidget* mParentWidget;
|
2006-12-19 23:47:53 +03:00
|
|
|
|
2006-09-27 11:53:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2016-07-20 14:37:00 +03:00
|
|
|
// weak ref to this childview's associated mozAccessible for speed reasons
|
2006-09-27 11:53:07 +04:00
|
|
|
// (we get queried for it *a lot* but don't want to own it)
|
|
|
|
nsWeakPtr mAccessible;
|
|
|
|
#endif
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2013-10-09 18:39:23 +04:00
|
|
|
// Protects the view from being teared down while a composition is in
|
|
|
|
// progress on the compositor thread.
|
|
|
|
mozilla::Mutex mViewTearDownLock;
|
|
|
|
|
2013-04-22 06:40:51 +04:00
|
|
|
mozilla::Mutex mEffectsLock;
|
|
|
|
|
|
|
|
// May be accessed from any thread, protected
|
|
|
|
// by mEffectsLock.
|
2019-04-26 22:26:17 +03:00
|
|
|
bool mHasRoundedBottomCorners;
|
2013-04-22 06:40:51 +04:00
|
|
|
int mDevPixelCornerRadius;
|
2013-05-23 18:49:17 +04:00
|
|
|
bool mIsCoveringTitlebar;
|
2014-01-17 14:06:15 +04:00
|
|
|
bool mIsFullscreen;
|
2016-09-07 06:35:03 +03:00
|
|
|
bool mIsOpaque;
|
2015-11-19 06:10:38 +03:00
|
|
|
LayoutDeviceIntRect mTitlebarRect;
|
2013-05-23 18:49:17 +04:00
|
|
|
|
2013-11-27 09:49:45 +04:00
|
|
|
// The area of mTitlebarCGContext that needs to be redrawn during the next
|
2013-05-23 18:49:17 +04:00
|
|
|
// transaction. Accessed from any thread, protected by mEffectsLock.
|
2015-11-19 06:10:38 +03:00
|
|
|
LayoutDeviceIntRegion mUpdatedTitlebarRegion;
|
2013-11-27 09:49:45 +04:00
|
|
|
CGContextRef mTitlebarCGContext;
|
2013-04-22 06:40:51 +04:00
|
|
|
|
|
|
|
// Compositor thread only
|
2016-06-29 06:24:44 +03:00
|
|
|
mozilla::UniquePtr<mozilla::widget::RectTextureImage> mCornerMaskImage;
|
|
|
|
mozilla::UniquePtr<mozilla::widget::RectTextureImage> mTitlebarImage;
|
|
|
|
mozilla::UniquePtr<mozilla::widget::RectTextureImage> mBasicCompositorImage;
|
2013-05-23 18:49:17 +04:00
|
|
|
|
2017-06-22 01:58:41 +03:00
|
|
|
// Main thread + webrender only
|
|
|
|
mozilla::Maybe<mozilla::wr::ImageKey> mTitlebarImageKey;
|
2017-07-04 05:56:04 +03:00
|
|
|
mozilla::gfx::IntSize mTitlebarImageSize;
|
2017-06-22 01:58:41 +03:00
|
|
|
|
2013-11-27 09:49:45 +04:00
|
|
|
// The area of mTitlebarCGContext that has changed and needs to be
|
2013-05-23 18:49:17 +04:00
|
|
|
// uploaded to to mTitlebarImage. Main thread only.
|
|
|
|
nsIntRegion mDirtyTitlebarRegion;
|
2006-08-31 02:06:44 +04:00
|
|
|
|
2016-07-11 23:15:07 +03:00
|
|
|
mozilla::ViewRegion mNonDraggableRegion;
|
2014-09-18 12:52:30 +04:00
|
|
|
|
2012-09-29 15:36:09 +04:00
|
|
|
// Cached value of [mView backingScaleFactor], to avoid sending two obj-c
|
|
|
|
// messages (respondsToSelector, backingScaleFactor) every time we need to
|
|
|
|
// use it.
|
|
|
|
// ** We'll need to reinitialize this if the backing resolution changes. **
|
2014-08-28 04:15:29 +04:00
|
|
|
mutable CGFloat mBackingScaleFactor;
|
2012-09-29 15:36:09 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mVisible;
|
|
|
|
bool mDrawing;
|
|
|
|
bool mIsDispatchPaint; // Is a paint event being dispatched
|
2008-01-16 02:11:55 +03:00
|
|
|
|
2015-02-20 19:37:02 +03:00
|
|
|
bool mPluginFocused;
|
|
|
|
|
2019-08-16 04:10:40 +03:00
|
|
|
// Used in BasicCompositor OMTC mode. Presents the BasicCompositor result
|
2013-07-09 08:21:05 +04:00
|
|
|
// surface to the screen using an OpenGL context.
|
2019-08-16 04:12:18 +03:00
|
|
|
// Always null if StaticPrefs::gfx_core_animation_enabled_AtStartup() is true.
|
2016-07-22 11:56:13 +03:00
|
|
|
mozilla::UniquePtr<GLPresenter> mGLPresenter;
|
2013-07-09 08:21:05 +04:00
|
|
|
|
2014-08-28 04:15:33 +04:00
|
|
|
mozilla::UniquePtr<mozilla::VibrancyManager> mVibrancyManager;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::SwipeTracker> mSwipeTracker;
|
2015-08-12 07:15:32 +03:00
|
|
|
mozilla::UniquePtr<mozilla::SwipeEventQueue> mSwipeEventQueue;
|
2014-08-28 04:15:33 +04:00
|
|
|
|
2016-05-31 21:35:54 +03:00
|
|
|
// Only used for drawRect-based painting in popups.
|
2019-08-16 04:12:18 +03:00
|
|
|
// Always null if StaticPrefs::gfx_core_animation_enabled_AtStartup() is true.
|
2016-05-31 21:35:54 +03:00
|
|
|
RefPtr<mozilla::gfx::DrawTarget> mBackingSurface;
|
|
|
|
|
2015-08-27 07:23:09 +03:00
|
|
|
// This flag is only used when APZ is off. It indicates that the current pan
|
|
|
|
// gesture was processed as a swipe. Sometimes the swipe animation can finish
|
|
|
|
// before momentum events of the pan gesture have stopped firing, so this
|
|
|
|
// flag tells us that we shouldn't allow the remaining events to cause
|
|
|
|
// scrolling. It is reset to false once a new gesture starts (as indicated by
|
|
|
|
// a PANGESTURE_(MAY)START event).
|
|
|
|
bool mCurrentPanGestureBelongsToSwipe;
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t sLastInputEventCount;
|
2013-11-27 09:49:45 +04:00
|
|
|
|
|
|
|
void ReleaseTitlebarCGContext();
|
2016-07-26 03:33:09 +03:00
|
|
|
|
|
|
|
// This is used by SynthesizeNativeTouchPoint to maintain state between
|
|
|
|
// multiple synthesized points
|
|
|
|
mozilla::UniquePtr<mozilla::MultiTouchInput> mSynthesizedTouchInput;
|
2001-11-06 18:35:24 +03:00
|
|
|
};
|
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#endif // nsChildView_h_
|