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
|
|
|
|
2006-08-31 02:06:44 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2001-11-06 18:35:24 +03:00
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsBaseWidget.h"
|
2008-04-24 02:56:40 +04:00
|
|
|
#include "nsIPluginInstanceOwner.h"
|
2002-12-13 11:43:18 +03:00
|
|
|
#include "nsIPluginWidget.h"
|
2006-09-27 11:53:07 +04:00
|
|
|
#include "nsWeakPtr.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"
|
2001-11-06 18:35:24 +03:00
|
|
|
|
|
|
|
#include "nsString.h"
|
2006-10-26 02:45:22 +04:00
|
|
|
#include "nsIDragService.h"
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2009-09-01 05:00:13 +04:00
|
|
|
#include "npapi.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
|
|
|
|
2011-06-11 11:12:58 +04:00
|
|
|
// The header files QuickdrawAPI.h and QDOffscreen.h are missing on OS X 10.7
|
|
|
|
// and up (though the QuickDraw APIs defined in them are still present) -- so
|
|
|
|
// we need to supply the relevant parts of their contents here. It's likely
|
|
|
|
// that Apple will eventually remove the APIs themselves (probably in OS X
|
|
|
|
// 10.8), so we need to make them weak imports, and test for their presence
|
|
|
|
// before using them.
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
#if !defined(__QUICKDRAWAPI__)
|
|
|
|
|
|
|
|
extern void SetPort(GrafPtr port)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
extern void SetOrigin(short h, short v)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
extern RgnHandle NewRgn(void)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
extern void DisposeRgn(RgnHandle rgn)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
extern void RectRgn(RgnHandle rgn, const Rect * r)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
extern GDHandle GetMainDevice(void)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
extern Boolean IsPortOffscreen(CGrafPtr port)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
extern void SetPortVisibleRegion(CGrafPtr port, RgnHandle visRgn)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
extern void SetPortClipRegion(CGrafPtr port, RgnHandle clipRgn)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
extern CGrafPtr GetQDGlobalsThePort(void)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
|
|
|
|
#endif /* __QUICKDRAWAPI__ */
|
|
|
|
|
|
|
|
#if !defined(__QDOFFSCREEN__)
|
|
|
|
|
|
|
|
extern void GetGWorld(CGrafPtr * port, GDHandle * gdh)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
extern void SetGWorld(CGrafPtr port, GDHandle gdh)
|
|
|
|
__attribute__((weak_import));
|
|
|
|
|
|
|
|
#endif /* __QDOFFSCREEN__ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-04-06 04:26:53 +04:00
|
|
|
class gfxASurface;
|
2001-11-06 18:35:24 +03:00
|
|
|
class nsChildView;
|
2009-08-14 02:06:49 +04:00
|
|
|
class nsCocoaWindow;
|
2007-04-06 04:26:53 +04:00
|
|
|
union nsPluginPort;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2013-07-09 08:21:05 +04:00
|
|
|
namespace {
|
|
|
|
class GLPresenter;
|
|
|
|
class RectTextureImage;
|
2011-02-20 01:23:02 +03:00
|
|
|
}
|
2012-01-19 18:45:37 +04:00
|
|
|
|
2013-07-09 08:21:05 +04:00
|
|
|
namespace mozilla {
|
2014-08-28 04:15:33 +04:00
|
|
|
class VibrancyManager;
|
2012-01-19 18:45:37 +04:00
|
|
|
namespace layers {
|
2013-04-17 01:35:57 +04:00
|
|
|
class GLManager;
|
2014-06-04 16:44:27 +04:00
|
|
|
class APZCTreeManager;
|
2012-01-19 18:45:37 +04:00
|
|
|
}
|
2011-02-20 01:23:02 +03:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
@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;
|
|
|
|
|
2013-04-19 03:40:40 +04:00
|
|
|
@end
|
|
|
|
|
2012-04-30 03:43:21 +04:00
|
|
|
#if !defined(MAC_OS_X_VERSION_10_6) || \
|
|
|
|
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
|
|
|
|
@interface NSEvent (SnowLeopardEventFeatures)
|
|
|
|
+ (NSUInteger)pressedMouseButtons;
|
2012-05-16 04:28:48 +04:00
|
|
|
+ (NSUInteger)modifierFlags;
|
2012-04-30 03:43:21 +04:00
|
|
|
@end
|
|
|
|
#endif
|
|
|
|
|
2011-08-11 21:42:23 +04:00
|
|
|
// The following section, required to support fluid swipe tracking on OS X 10.7
|
|
|
|
// and up, contains defines/declarations that are only available on 10.7 and up.
|
|
|
|
// [NSEvent trackSwipeEventWithOptions:...] also requires that the compiler
|
|
|
|
// support "blocks"
|
|
|
|
// (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Blocks/Articles/00_Introduction.html)
|
|
|
|
// -- which it does on 10.6 and up (using the 10.6 SDK or higher).
|
2011-08-12 20:48:29 +04:00
|
|
|
//
|
|
|
|
// MAC_OS_X_VERSION_MAX_ALLOWED "controls which OS functionality, if used,
|
|
|
|
// will result in a compiler error because that functionality is not
|
|
|
|
// available" (quoting from AvailabilityMacros.h). The compiler initializes
|
|
|
|
// it to the version of the SDK being used. Its value does *not* prevent the
|
|
|
|
// binary from running on higher OS versions. MAC_OS_X_VERSION_10_7 and
|
|
|
|
// friends are defined (in AvailabilityMacros.h) as decimal numbers (not
|
|
|
|
// hexadecimal numbers).
|
|
|
|
#if !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
|
2014-01-17 14:06:15 +04:00
|
|
|
enum {
|
|
|
|
NSFullScreenWindowMask = 1 << 14
|
|
|
|
};
|
|
|
|
|
2013-12-20 03:19:17 +04:00
|
|
|
@interface NSWindow (LionWindowFeatures)
|
|
|
|
- (NSRect)convertRectToScreen:(NSRect)aRect;
|
|
|
|
@end
|
|
|
|
|
2012-06-20 22:34:45 +04:00
|
|
|
#ifdef __LP64__
|
2011-08-11 21:42:23 +04:00
|
|
|
enum {
|
|
|
|
NSEventSwipeTrackingLockDirection = 0x1 << 0,
|
|
|
|
NSEventSwipeTrackingClampGestureAmount = 0x1 << 1
|
|
|
|
};
|
|
|
|
typedef NSUInteger NSEventSwipeTrackingOptions;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
NSEventGestureAxisNone = 0,
|
|
|
|
NSEventGestureAxisHorizontal,
|
|
|
|
NSEventGestureAxisVertical
|
|
|
|
};
|
|
|
|
typedef NSInteger NSEventGestureAxis;
|
|
|
|
|
|
|
|
@interface NSEvent (FluidSwipeTracking)
|
|
|
|
+ (BOOL)isSwipeTrackingFromScrollEventsEnabled;
|
|
|
|
- (BOOL)hasPreciseScrollingDeltas;
|
|
|
|
- (CGFloat)scrollingDeltaX;
|
|
|
|
- (CGFloat)scrollingDeltaY;
|
|
|
|
- (NSEventPhase)phase;
|
|
|
|
- (void)trackSwipeEventWithOptions:(NSEventSwipeTrackingOptions)options
|
|
|
|
dampenAmountThresholdMin:(CGFloat)minDampenThreshold
|
|
|
|
max:(CGFloat)maxDampenThreshold
|
|
|
|
usingHandler:(void (^)(CGFloat gestureAmount, NSEventPhase phase, BOOL isComplete, BOOL *stop))trackingHandler;
|
|
|
|
@end
|
|
|
|
#endif // #ifdef __LP64__
|
2011-08-12 20:48:29 +04:00
|
|
|
#endif // #if !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
|
2011-08-11 21:42:23 +04:00
|
|
|
|
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
|
2013-07-11 11:46:35 +04:00
|
|
|
mozView, NSTextInput, NSTextInputClient>
|
2001-11-06 18:35:24 +03:00
|
|
|
{
|
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]
|
|
|
|
|
2002-04-27 04:19:49 +04:00
|
|
|
BOOL mIsPluginView;
|
2009-09-01 05:00:13 +04:00
|
|
|
NPEventModel mPluginEventModel;
|
2010-09-17 21:55:39 +04:00
|
|
|
NPDrawingModel mPluginDrawingModel;
|
2001-11-15 01:29:25 +03:00
|
|
|
|
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
|
|
|
|
|
|
|
// Whether the last mouse down event was blocked from Gecko.
|
|
|
|
BOOL mBlockedLastMouseDown;
|
|
|
|
|
|
|
|
// when acceptsFirstMouse: is called, we store the event here (strong)
|
|
|
|
NSEvent* mClickThroughMouseDownEvent;
|
|
|
|
|
2006-11-09 17:00:08 +03:00
|
|
|
// rects that were invalidated during a draw, so have pending drawing
|
|
|
|
NSMutableArray* mPendingDirtyRects;
|
|
|
|
BOOL mPendingFullDisplay;
|
2010-06-09 08:11:42 +04:00
|
|
|
BOOL mPendingDisplay;
|
2006-10-26 02:45:22 +04:00
|
|
|
|
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;
|
|
|
|
|
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
|
|
|
|
2010-06-18 13:22:01 +04:00
|
|
|
NSOpenGLContext *mGLContext;
|
2010-04-28 02:29:29 +04:00
|
|
|
|
2008-10-24 00:15:20 +04:00
|
|
|
// Simple gestures support
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// 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,
|
|
|
|
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
|
|
|
|
|
|
|
BOOL mDidForceRefreshOpenGL;
|
2013-03-05 19:21:28 +04:00
|
|
|
BOOL mWaitingForPaint;
|
2011-08-11 21:42:23 +04: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;
|
2013-10-11 23:48:53 +04:00
|
|
|
uint32_t mCurrentSwipeDir;
|
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).
|
|
|
|
CGImageRef mTopLeftCornerMask;
|
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
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
- (void)sendFocusEvent:(uint32_t)eventType;
|
2008-06-30 20:30:22 +04:00
|
|
|
|
2009-09-23 06:31:37 +04:00
|
|
|
- (void)handleMouseMoved:(NSEvent*)aEvent;
|
|
|
|
|
2013-02-06 01:40:34 +04:00
|
|
|
- (void)updateWindowDraggableStateOnMouseMove:(NSEvent*)theEvent;
|
|
|
|
|
2009-09-23 06:31:37 +04:00
|
|
|
- (void)sendMouseEnterOrExitEvent:(NSEvent*)aEvent
|
|
|
|
enter:(BOOL)aEnter
|
2013-10-02 10:38:27 +04:00
|
|
|
type:(mozilla::WidgetMouseEvent::exitType)aType;
|
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
|
|
|
|
2010-08-17 07:26:17 +04:00
|
|
|
- (BOOL)isPluginView;
|
|
|
|
|
2010-11-16 00:12:50 +03:00
|
|
|
// Are we processing an NSLeftMouseDown event that will fail to click through?
|
|
|
|
// If so, we shouldn't focus or unfocus a plugin.
|
|
|
|
- (BOOL)isInFailingLeftClickThrough;
|
|
|
|
|
2012-01-19 18:45:37 +04:00
|
|
|
- (void)setGLContext:(NSOpenGLContext *)aGLContext;
|
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
|
|
|
|
2013-05-23 18:49:17 +04:00
|
|
|
- (BOOL)isCoveringTitlebar;
|
|
|
|
|
2008-10-24 00:15:20 +04:00
|
|
|
// Simple gestures support
|
|
|
|
//
|
|
|
|
// XXX - The swipeWithEvent, beginGestureWithEvent, magnifyWithEvent,
|
|
|
|
// rotateWithEvent, and endGestureWithEvent methods are part of a
|
|
|
|
// PRIVATE interface exported by nsResponder and reverse-engineering
|
|
|
|
// was necessary to obtain the methods' prototypes. Thus, Apple may
|
|
|
|
// change the interface in the future without notice.
|
|
|
|
//
|
|
|
|
// The prototypes were obtained from the following link:
|
|
|
|
// http://cocoadex.com/2008/02/nsevent-modifications-swipe-ro.html
|
|
|
|
- (void)swipeWithEvent:(NSEvent *)anEvent;
|
|
|
|
- (void)beginGestureWithEvent:(NSEvent *)anEvent;
|
|
|
|
- (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;
|
2014-06-04 16:44:27 +04:00
|
|
|
- (void)handleAsyncScrollEvent:(CGEventRef)cgEvent ofType:(CGEventType)type;
|
2013-08-17 01:17:40 +04:00
|
|
|
|
2013-04-29 19:24:26 +04:00
|
|
|
// Helper function for Lion smart magnify events
|
|
|
|
+ (BOOL)isLionSmartMagnifyEvent:(NSEvent*)anEvent;
|
|
|
|
|
2011-08-11 21:42:23 +04:00
|
|
|
// Support for fluid swipe tracking.
|
|
|
|
#ifdef __LP64__
|
|
|
|
- (void)maybeTrackScrollEventAsSwipe:(NSEvent *)anEvent
|
2013-10-11 23:48:53 +04:00
|
|
|
scrollOverflowX:(double)anOverflowX
|
|
|
|
scrollOverflowY:(double)anOverflowY
|
|
|
|
viewPortIsOverscrolled:(BOOL)aViewPortIsOverscrolled;
|
2011-08-11 21:42:23 +04:00
|
|
|
#endif
|
2012-01-19 18:45:37 +04:00
|
|
|
|
|
|
|
- (void)setUsingOMTCompositor:(BOOL)aUseOMTC;
|
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);
|
2013-10-01 11:23:02 +04:00
|
|
|
static void AttachPluginEvent(mozilla::WidgetMouseEventBase& aMouseEvent,
|
2013-09-18 03:36:03 +04:00
|
|
|
ChildView* aView,
|
|
|
|
NSEvent* aNativeMouseEvent,
|
|
|
|
int aPluginEventType,
|
|
|
|
void* aPluginEventHolder);
|
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
|
|
|
|
//
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2002-12-13 11:43:18 +03:00
|
|
|
class nsChildView : public nsBaseWidget,
|
2008-07-14 06:56:18 +04:00
|
|
|
public nsIPluginWidget
|
2001-11-06 18:35:24 +03:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
typedef nsBaseWidget Inherited;
|
2014-06-04 16:44:27 +04:00
|
|
|
typedef mozilla::layers::APZCTreeManager APZCTreeManager;
|
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
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2005-09-30 04:59:29 +04:00
|
|
|
|
2001-11-15 01:29:25 +03:00
|
|
|
// nsIWidget interface
|
|
|
|
NS_IMETHOD Create(nsIWidget *aParent,
|
2009-09-24 10:18:10 +04:00
|
|
|
nsNativeWidget aNativeParent,
|
2009-01-15 06:27:09 +03:00
|
|
|
const nsIntRect &aRect,
|
2011-04-17 05:22:44 +04:00
|
|
|
nsDeviceContext *aContext,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsWidgetInitData *aInitData = nullptr);
|
2001-11-15 01:29:25 +03:00
|
|
|
|
|
|
|
NS_IMETHOD Destroy();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD Show(bool aState);
|
2012-07-19 12:57:50 +04:00
|
|
|
virtual bool IsVisible() const;
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2008-10-29 08:19:42 +03:00
|
|
|
NS_IMETHOD SetParent(nsIWidget* aNewParent);
|
2002-02-12 11:30:01 +03:00
|
|
|
virtual nsIWidget* GetParent(void);
|
2010-08-13 13:57:55 +04:00
|
|
|
virtual float GetDPI();
|
2008-02-20 10:40:04 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t *aX, int32_t *aY);
|
2012-12-12 13:57:38 +04:00
|
|
|
NS_IMETHOD Move(double aX, double aY);
|
|
|
|
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint);
|
|
|
|
NS_IMETHOD Resize(double aX, double aY,
|
|
|
|
double aWidth, double aHeight, bool aRepaint);
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD Enable(bool aState);
|
2012-07-23 09:19:08 +04:00
|
|
|
virtual bool IsEnabled() const;
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD SetFocus(bool aRaise);
|
2009-01-15 06:27:09 +03:00
|
|
|
NS_IMETHOD GetBounds(nsIntRect &aRect);
|
2013-01-16 00:47:42 +04:00
|
|
|
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
2013-02-11 02:31:00 +04:00
|
|
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
2001-11-15 01:29:25 +03:00
|
|
|
|
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
|
|
|
|
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();
|
|
|
|
|
2012-10-31 04:31:35 +04:00
|
|
|
virtual double GetDefaultScaleInternal();
|
2012-09-29 15:36:09 +04:00
|
|
|
|
2013-07-30 20:22:41 +04:00
|
|
|
virtual int32_t RoundsWidgetCoordinatesTo() MOZ_OVERRIDE;
|
|
|
|
|
2011-12-24 07:52:21 +04:00
|
|
|
NS_IMETHOD Invalidate(const nsIntRect &aRect);
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType);
|
2009-07-22 04:44:55 +04:00
|
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
|
2009-02-19 03:11:49 +03:00
|
|
|
virtual nsIntPoint WidgetToScreenOffset();
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool ShowsResizeIndicator(nsIntRect* aResizerRect);
|
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; }
|
2013-10-02 07:46:03 +04:00
|
|
|
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aStatus);
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2012-11-15 22:55:15 +04:00
|
|
|
virtual bool ComputeShouldAccelerate(bool aDefault);
|
2013-06-24 09:27:29 +04:00
|
|
|
virtual bool ShouldUseOffMainThreadCompositing() MOZ_OVERRIDE;
|
2006-03-18 02:35:39 +03:00
|
|
|
|
2001-11-15 01:29:25 +03:00
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor, uint32_t aHotspotX, uint32_t aHotspotY);
|
2012-01-19 18:45:37 +04:00
|
|
|
|
2012-10-26 17:15:22 +04:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, bool aDoCapture);
|
2004-04-19 03:18:23 +04:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& title);
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD GetAttention(int32_t aCycleCount);
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool HasPendingInputEvent();
|
2009-04-22 03:53:52 +04:00
|
|
|
|
2008-07-28 08:46:33 +04:00
|
|
|
NS_IMETHOD ActivateNativeMenuItemAt(const nsAString& indexString);
|
2008-10-30 08:36:01 +03:00
|
|
|
NS_IMETHOD ForceUpdateNativeMenuAt(const nsAString& indexString);
|
2008-06-28 11:55:30 +04:00
|
|
|
|
2014-02-18 04:00:15 +04:00
|
|
|
NS_IMETHOD NotifyIME(const IMENotification& aIMENotification) MOZ_OVERRIDE;
|
2011-11-27 15:51:52 +04:00
|
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction);
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext();
|
2014-04-22 00:40:09 +04:00
|
|
|
NS_IMETHOD AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent);
|
2014-03-14 17:13:31 +04:00
|
|
|
NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
|
|
|
|
NativeKeyBindingsType aType,
|
|
|
|
const mozilla::WidgetKeyboardEvent& aEvent,
|
|
|
|
DoCommandCallback aCallback,
|
|
|
|
void* aCallbackData) MOZ_OVERRIDE;
|
2013-07-11 11:46:35 +04:00
|
|
|
virtual nsIMEUpdatePreference GetIMEUpdatePreference() MOZ_OVERRIDE;
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool* aLEDState);
|
2008-07-14 06:56:18 +04:00
|
|
|
|
2002-12-13 11:43:18 +03:00
|
|
|
// nsIPluginWidget
|
2013-01-05 02:39:22 +04:00
|
|
|
// outClipRect and outOrigin are in display pixels (not device pixels)
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD GetPluginClipRect(nsIntRect& outClipRect, nsIntPoint& outOrigin, bool& outWidgetVisible);
|
2002-12-13 11:43:18 +03:00
|
|
|
NS_IMETHOD StartDrawPlugin();
|
|
|
|
NS_IMETHOD EndDrawPlugin();
|
2008-04-24 02:56:40 +04:00
|
|
|
NS_IMETHOD SetPluginInstanceOwner(nsIPluginInstanceOwner* aInstanceOwner);
|
2009-08-27 04:29:47 +04:00
|
|
|
|
|
|
|
NS_IMETHOD SetPluginEventModel(int inEventModel);
|
|
|
|
NS_IMETHOD GetPluginEventModel(int* outEventModel);
|
2010-09-17 21:55:39 +04:00
|
|
|
NS_IMETHOD SetPluginDrawingModel(int inDrawingModel);
|
2009-08-27 04:29:47 +04:00
|
|
|
|
2010-06-10 04:56:17 +04:00
|
|
|
NS_IMETHOD StartComplexTextInputForCurrentEvent();
|
|
|
|
|
2008-08-13 04:44:14 +04:00
|
|
|
virtual nsTransparencyMode GetTransparencyMode();
|
2013-07-04 02:33:37 +04:00
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
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,
|
|
|
|
uint32_t aModifierFlags,
|
2009-09-23 06:31:37 +04:00
|
|
|
const nsAString& aCharacters,
|
|
|
|
const nsAString& aUnmodifiedCharacters);
|
|
|
|
|
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aNativeMessage,
|
|
|
|
uint32_t aModifierFlags);
|
2012-04-12 01:55:21 +04:00
|
|
|
|
|
|
|
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
|
|
|
{ return SynthesizeNativeMouseEvent(aPoint, NSMouseMoved, 0); }
|
|
|
|
|
2001-11-15 01:29:25 +03:00
|
|
|
// Mac specific methods
|
2002-03-11 05:39:45 +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();
|
2013-05-23 18:49:16 +04:00
|
|
|
bool PaintWindow(nsIntRegion aRegion);
|
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
|
|
|
|
2014-06-04 16:44:27 +04:00
|
|
|
virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight);
|
2012-01-19 18:45:37 +04:00
|
|
|
virtual void CreateCompositor();
|
2013-04-22 06:40:51 +04:00
|
|
|
virtual void PrepareWindowEffects() MOZ_OVERRIDE;
|
|
|
|
virtual void CleanupWindowEffects() MOZ_OVERRIDE;
|
2013-12-09 05:40:59 +04:00
|
|
|
virtual bool PreRender(LayerManagerComposite* aManager) MOZ_OVERRIDE;
|
|
|
|
virtual void PostRender(LayerManagerComposite* aManager) MOZ_OVERRIDE;
|
|
|
|
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) MOZ_OVERRIDE;
|
2006-12-19 23:47:53 +03:00
|
|
|
|
2011-01-11 16:03:16 +03:00
|
|
|
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries);
|
|
|
|
|
2008-04-24 02:56:40 +04:00
|
|
|
void HidePlugin();
|
2009-07-22 12:57:39 +04:00
|
|
|
void UpdatePluginPort();
|
2008-04-24 02:56:40 +04:00
|
|
|
|
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();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsPluginView() { return (mWindowType == eWindowType_plugin); }
|
2010-09-07 21:20:03 +04:00
|
|
|
|
2010-11-16 00:12:50 +03:00
|
|
|
nsCocoaWindow* GetXULWindowWidget();
|
|
|
|
|
2010-09-18 15:28:50 +04:00
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
2011-02-24 07:48:12 +03:00
|
|
|
|
|
|
|
mozilla::widget::TextInputHandler* GetTextInputHandler()
|
|
|
|
{
|
|
|
|
return mTextInputHandler;
|
|
|
|
}
|
|
|
|
|
2013-05-23 18:49:17 +04:00
|
|
|
void NotifyDirtyRegion(const nsIntRegion& aDirtyRegion);
|
2014-08-28 04:15:33 +04:00
|
|
|
void ClearVibrantAreas();
|
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());
|
|
|
|
}
|
2014-08-28 04:15:29 +04:00
|
|
|
nsIntPoint CocoaPointsToDevPixels(const NSPoint& aPt) const {
|
2012-09-29 15:36:09 +04:00
|
|
|
return nsCocoaUtils::CocoaPointsToDevPixels(aPt, BackingScaleFactor());
|
|
|
|
}
|
2014-08-28 04:15:29 +04:00
|
|
|
nsIntRect 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());
|
|
|
|
}
|
2014-08-28 04:15:29 +04:00
|
|
|
NSRect DevPixelsToCocoaPoints(const nsIntRect& aRect) const {
|
2012-09-29 15:36:09 +04:00
|
|
|
return nsCocoaUtils::DevPixelsToCocoaPoints(aRect, BackingScaleFactor());
|
|
|
|
}
|
|
|
|
|
2013-07-09 08:21:05 +04:00
|
|
|
mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() MOZ_OVERRIDE;
|
|
|
|
void EndRemoteDrawing() MOZ_OVERRIDE;
|
|
|
|
void CleanupRemoteDrawing() MOZ_OVERRIDE;
|
|
|
|
|
2014-06-04 16:44:27 +04:00
|
|
|
APZCTreeManager* APZCTM() { return mAPZCTreeManager; }
|
|
|
|
|
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
|
|
|
|
2006-12-20 06:41:43 +03:00
|
|
|
// override to create different kinds of child views. Autoreleases, so
|
|
|
|
// caller must retain.
|
2005-09-30 04:59:29 +04:00
|
|
|
virtual NSView* CreateCocoaView(NSRect inFrame);
|
|
|
|
void TearDownView();
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2010-08-20 23:29:02 +04:00
|
|
|
virtual already_AddRefed<nsIWidget>
|
|
|
|
AllocateChildPopupWidget()
|
|
|
|
{
|
|
|
|
static NS_DEFINE_IID(kCPopUpCID, NS_POPUP_CID);
|
|
|
|
nsCOMPtr<nsIWidget> widget = do_CreateInstance(kCPopUpCID);
|
|
|
|
return widget.forget();
|
|
|
|
}
|
|
|
|
|
2013-07-09 08:21:05 +04:00
|
|
|
void DoRemoteComposition(const nsIntRect& aRenderRect);
|
|
|
|
|
2013-05-23 18:49:17 +04:00
|
|
|
// Overlay drawing functions for OpenGL drawing
|
2013-07-09 08:21:05 +04:00
|
|
|
void DrawWindowOverlay(mozilla::layers::GLManager* aManager, nsIntRect aRect);
|
2013-05-23 18:49:17 +04:00
|
|
|
void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
|
|
|
|
void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
|
|
|
|
void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
|
|
|
|
|
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
|
|
|
|
|
|
|
nsIntRect 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();
|
|
|
|
|
2005-09-30 04:59:29 +04:00
|
|
|
protected:
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2005-09-30 04:59:29 +04:00
|
|
|
NSView<mozView>* mView; // my parallel cocoa view (ChildView or NativeScrollbarView), [STRONG]
|
2011-05-08 14:19:23 +04:00
|
|
|
nsRefPtr<mozilla::widget::TextInputHandler> mTextInputHandler;
|
2011-11-27 15:51:52 +04:00
|
|
|
InputContext mInputContext;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2005-09-30 04:59:29 +04:00
|
|
|
NSView<mozView>* 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
|
|
|
|
// weak ref to this childview's associated mozAccessible for speed reasons
|
|
|
|
// (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.
|
|
|
|
bool mShowsResizeIndicator;
|
|
|
|
nsIntRect mResizeIndicatorRect;
|
|
|
|
bool mHasRoundedBottomCorners;
|
|
|
|
int mDevPixelCornerRadius;
|
2013-05-23 18:49:17 +04:00
|
|
|
bool mIsCoveringTitlebar;
|
2014-01-17 14:06:15 +04:00
|
|
|
bool mIsFullscreen;
|
2013-05-23 18:49:17 +04:00
|
|
|
nsIntRect mTitlebarRect;
|
|
|
|
|
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.
|
|
|
|
nsIntRegion mUpdatedTitlebarRegion;
|
2013-11-27 09:49:45 +04:00
|
|
|
CGContextRef mTitlebarCGContext;
|
2013-04-22 06:40:51 +04:00
|
|
|
|
|
|
|
// Compositor thread only
|
2013-07-09 08:21:05 +04:00
|
|
|
nsAutoPtr<RectTextureImage> mResizerImage;
|
|
|
|
nsAutoPtr<RectTextureImage> mCornerMaskImage;
|
|
|
|
nsAutoPtr<RectTextureImage> mTitlebarImage;
|
|
|
|
nsAutoPtr<RectTextureImage> mBasicCompositorImage;
|
2013-05-23 18:49:17 +04: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
|
|
|
|
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 mPluginDrawing;
|
|
|
|
bool mIsDispatchPaint; // Is a paint event being dispatched
|
2008-01-16 02:11:55 +03:00
|
|
|
|
2009-09-17 05:30:26 +04:00
|
|
|
NP_CGContext mPluginCGContext;
|
2008-04-24 02:56:40 +04:00
|
|
|
nsIPluginInstanceOwner* mPluginInstanceOwner; // [WEAK]
|
2009-04-22 03:53:52 +04:00
|
|
|
|
2013-07-09 08:21:05 +04:00
|
|
|
// Used in OMTC BasicLayers mode. Presents the BasicCompositor result
|
|
|
|
// surface to the screen using an OpenGL context.
|
|
|
|
nsAutoPtr<GLPresenter> mGLPresenter;
|
|
|
|
|
2014-06-04 16:44:27 +04:00
|
|
|
nsRefPtr<APZCTreeManager> mAPZCTreeManager;
|
|
|
|
|
2014-08-28 04:15:33 +04:00
|
|
|
mozilla::UniquePtr<mozilla::VibrancyManager> mVibrancyManager;
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t sLastInputEventCount;
|
2013-11-27 09:49:45 +04:00
|
|
|
|
|
|
|
void ReleaseTitlebarCGContext();
|
2001-11-06 18:35:24 +03:00
|
|
|
};
|
|
|
|
|
2008-06-30 20:30:22 +04:00
|
|
|
void NS_InstallPluginKeyEventsHandler();
|
|
|
|
void NS_RemovePluginKeyEventsHandler();
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#endif // nsChildView_h_
|