mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to m-i
This commit is contained in:
commit
c341483576
@ -552,7 +552,7 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
|
|||||||
NSScreen* mainView = [[NSScreen screens] objectAtIndex:0];
|
NSScreen* mainView = [[NSScreen screens] objectAtIndex:0];
|
||||||
NSPoint tmpPoint = NSMakePoint(point.x,
|
NSPoint tmpPoint = NSMakePoint(point.x,
|
||||||
[mainView frame].size.height - point.y);
|
[mainView frame].size.height - point.y);
|
||||||
LayoutDeviceIntPoint geckoPoint = nsCocoaUtils::
|
nsIntPoint geckoPoint = nsCocoaUtils::
|
||||||
CocoaPointsToDevPixels(tmpPoint, nsCocoaUtils::GetBackingScaleFactor(mainView));
|
CocoaPointsToDevPixels(tmpPoint, nsCocoaUtils::GetBackingScaleFactor(mainView));
|
||||||
|
|
||||||
mozAccessible* nativeChild = nil;
|
mozAccessible* nativeChild = nil;
|
||||||
|
@ -810,9 +810,10 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allow widget to render a custom foreground.
|
// Allow widget to render a custom foreground.
|
||||||
mCompositor->GetWidget()->DrawWindowOverlay(
|
mCompositor->GetWidget()->DrawWindowOverlay(this, IntRect(actualBounds.x,
|
||||||
this, LayoutDeviceIntRect(actualBounds.x, actualBounds.y,
|
actualBounds.y,
|
||||||
actualBounds.width, actualBounds.height));
|
actualBounds.width,
|
||||||
|
actualBounds.height));
|
||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
RenderDebugOverlay(actualBounds);
|
RenderDebugOverlay(actualBounds);
|
||||||
|
@ -4954,7 +4954,7 @@ ScrollFrameHelper::AdjustScrollbarRectForResizer(
|
|||||||
else {
|
else {
|
||||||
nsPoint offset;
|
nsPoint offset;
|
||||||
nsIWidget* widget = aFrame->GetNearestWidget(offset);
|
nsIWidget* widget = aFrame->GetNearestWidget(offset);
|
||||||
LayoutDeviceIntRect widgetRect;
|
nsIntRect widgetRect;
|
||||||
if (!widget || !widget->ShowsResizeIndicator(&widgetRect))
|
if (!widget || !widget->ShowsResizeIndicator(&widgetRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2636,8 +2636,7 @@ nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager,
|
nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
||||||
LayoutDeviceIntRect aRect)
|
|
||||||
{
|
{
|
||||||
PROFILER_LABEL("nsWindow", "DrawWindowOverlay",
|
PROFILER_LABEL("nsWindow", "DrawWindowOverlay",
|
||||||
js::ProfileEntry::Category::GRAPHICS);
|
js::ProfileEntry::Category::GRAPHICS);
|
||||||
|
@ -152,7 +152,7 @@ public:
|
|||||||
|
|
||||||
virtual bool NeedsPaint() override;
|
virtual bool NeedsPaint() override;
|
||||||
virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) override;
|
virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) override;
|
||||||
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, LayoutDeviceIntRect aRect) override;
|
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) override;
|
||||||
|
|
||||||
virtual mozilla::layers::CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) override;
|
virtual mozilla::layers::CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) override;
|
||||||
|
|
||||||
|
@ -3316,7 +3316,8 @@ IMEInputHandler::FirstRectForCharacterRange(NSRange& aRange,
|
|||||||
if (!rootWindow || !rootView) {
|
if (!rootWindow || !rootView) {
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
rect = nsCocoaUtils::DevPixelsToCocoaPoints(r, mWidget->BackingScaleFactor());
|
rect = nsCocoaUtils::DevPixelsToCocoaPoints(r.ToUnknownRect(),
|
||||||
|
mWidget->BackingScaleFactor());
|
||||||
rect = [rootView convertRect:rect toView:nil];
|
rect = [rootView convertRect:rect toView:nil];
|
||||||
rect.origin = [rootWindow convertBaseToScreen:rect.origin];
|
rect.origin = [rootWindow convertBaseToScreen:rect.origin];
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ VibrancyManager::UpdateVibrantRegion(VibrancyType aType, const nsIntRegion& aReg
|
|||||||
for (size_t i = 0; (iterRect = iter.Next()) || i < viewsToRecycle.Length(); ++i) {
|
for (size_t i = 0; (iterRect = iter.Next()) || i < viewsToRecycle.Length(); ++i) {
|
||||||
if (iterRect) {
|
if (iterRect) {
|
||||||
NSView* view = nil;
|
NSView* view = nil;
|
||||||
NSRect rect = mCoordinateConverter.UntypedDevPixelsToCocoaPoints(*iterRect);
|
NSRect rect = mCoordinateConverter.DevPixelsToCocoaPoints(*iterRect);
|
||||||
if (i < viewsToRecycle.Length()) {
|
if (i < viewsToRecycle.Length()) {
|
||||||
view = viewsToRecycle[i];
|
view = viewsToRecycle[i];
|
||||||
[view setFrame:rect];
|
[view setFrame:rect];
|
||||||
@ -72,7 +72,7 @@ VibrancyManager::ClearVibrantRegion(const VibrantRegion& aVibrantRegion) const
|
|||||||
|
|
||||||
nsIntRegionRectIterator iter(aVibrantRegion.region);
|
nsIntRegionRectIterator iter(aVibrantRegion.region);
|
||||||
while (const nsIntRect* rect = iter.Next()) {
|
while (const nsIntRect* rect = iter.Next()) {
|
||||||
NSRectFill(mCoordinateConverter.UntypedDevPixelsToCocoaPoints(*rect));
|
NSRectFill(mCoordinateConverter.DevPixelsToCocoaPoints(*rect));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ public:
|
|||||||
virtual void* GetNativeData(uint32_t aDataType) override;
|
virtual void* GetNativeData(uint32_t aDataType) override;
|
||||||
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
|
||||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||||
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
|
virtual bool ShowsResizeIndicator(nsIntRect* aResizerRect) override;
|
||||||
|
|
||||||
static bool ConvertStatus(nsEventStatus aStatus)
|
static bool ConvertStatus(nsEventStatus aStatus)
|
||||||
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
||||||
@ -487,13 +487,12 @@ public:
|
|||||||
virtual void CleanupWindowEffects() override;
|
virtual void CleanupWindowEffects() override;
|
||||||
virtual bool PreRender(LayerManagerComposite* aManager) override;
|
virtual bool PreRender(LayerManagerComposite* aManager) override;
|
||||||
virtual void PostRender(LayerManagerComposite* aManager) override;
|
virtual void PostRender(LayerManagerComposite* aManager) override;
|
||||||
virtual void DrawWindowOverlay(LayerManagerComposite* aManager,
|
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) override;
|
||||||
LayoutDeviceIntRect aRect) override;
|
|
||||||
|
|
||||||
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
|
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
|
||||||
|
|
||||||
virtual void UpdateWindowDraggingRegion(const nsIntRegion& aRegion) override;
|
virtual void UpdateWindowDraggingRegion(const nsIntRegion& aRegion) override;
|
||||||
const LayoutDeviceIntRegion& GetDraggableRegion() { return mDraggableRegion; }
|
const nsIntRegion& GetDraggableRegion() { return mDraggableRegion; }
|
||||||
|
|
||||||
virtual void ReportSwipeStarted(uint64_t aInputBlockId, bool aStartSwipe) override;
|
virtual void ReportSwipeStarted(uint64_t aInputBlockId, bool aStartSwipe) override;
|
||||||
|
|
||||||
@ -522,21 +521,16 @@ public:
|
|||||||
int32_t CocoaPointsToDevPixels(CGFloat aPts) const {
|
int32_t CocoaPointsToDevPixels(CGFloat aPts) const {
|
||||||
return nsCocoaUtils::CocoaPointsToDevPixels(aPts, BackingScaleFactor());
|
return nsCocoaUtils::CocoaPointsToDevPixels(aPts, BackingScaleFactor());
|
||||||
}
|
}
|
||||||
LayoutDeviceIntPoint CocoaPointsToDevPixels(const NSPoint& aPt) const {
|
nsIntPoint CocoaPointsToDevPixels(const NSPoint& aPt) const {
|
||||||
return nsCocoaUtils::CocoaPointsToDevPixels(aPt, BackingScaleFactor());
|
return nsCocoaUtils::CocoaPointsToDevPixels(aPt, BackingScaleFactor());
|
||||||
}
|
}
|
||||||
LayoutDeviceIntRect CocoaPointsToDevPixels(const NSRect& aRect) const {
|
nsIntRect CocoaPointsToDevPixels(const NSRect& aRect) const {
|
||||||
return nsCocoaUtils::CocoaPointsToDevPixels(aRect, BackingScaleFactor());
|
return nsCocoaUtils::CocoaPointsToDevPixels(aRect, BackingScaleFactor());
|
||||||
}
|
}
|
||||||
CGFloat DevPixelsToCocoaPoints(int32_t aPixels) const {
|
CGFloat DevPixelsToCocoaPoints(int32_t aPixels) const {
|
||||||
return nsCocoaUtils::DevPixelsToCocoaPoints(aPixels, BackingScaleFactor());
|
return nsCocoaUtils::DevPixelsToCocoaPoints(aPixels, BackingScaleFactor());
|
||||||
}
|
}
|
||||||
// XXX: all calls to this function should eventually be replaced with calls
|
NSRect DevPixelsToCocoaPoints(const nsIntRect& aRect) const {
|
||||||
// to DevPixelsToCocoaPoints().
|
|
||||||
NSRect UntypedDevPixelsToCocoaPoints(const nsIntRect& aRect) const {
|
|
||||||
return nsCocoaUtils::UntypedDevPixelsToCocoaPoints(aRect, BackingScaleFactor());
|
|
||||||
}
|
|
||||||
NSRect DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect) const {
|
|
||||||
return nsCocoaUtils::DevPixelsToCocoaPoints(aRect, BackingScaleFactor());
|
return nsCocoaUtils::DevPixelsToCocoaPoints(aRect, BackingScaleFactor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,19 +577,19 @@ protected:
|
|||||||
void ConfigureAPZCTreeManager() override;
|
void ConfigureAPZCTreeManager() override;
|
||||||
void ConfigureAPZControllerThread() override;
|
void ConfigureAPZControllerThread() override;
|
||||||
|
|
||||||
void DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect);
|
void DoRemoteComposition(const nsIntRect& aRenderRect);
|
||||||
|
|
||||||
// Overlay drawing functions for OpenGL drawing
|
// Overlay drawing functions for OpenGL drawing
|
||||||
void DrawWindowOverlay(mozilla::layers::GLManager* aManager, LayoutDeviceIntRect aRect);
|
void DrawWindowOverlay(mozilla::layers::GLManager* aManager, nsIntRect aRect);
|
||||||
void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager);
|
void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
|
||||||
void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager, const LayoutDeviceIntRect& aRect);
|
void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
|
||||||
void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager);
|
void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
|
||||||
|
|
||||||
// Redraw the contents of mTitlebarCGContext on the main thread, as
|
// Redraw the contents of mTitlebarCGContext on the main thread, as
|
||||||
// determined by mDirtyTitlebarRegion.
|
// determined by mDirtyTitlebarRegion.
|
||||||
void UpdateTitlebarCGContext();
|
void UpdateTitlebarCGContext();
|
||||||
|
|
||||||
LayoutDeviceIntRect RectContainingTitlebarControls();
|
nsIntRect RectContainingTitlebarControls();
|
||||||
void UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries);
|
void UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries);
|
||||||
mozilla::VibrancyManager& EnsureVibrancyManager();
|
mozilla::VibrancyManager& EnsureVibrancyManager();
|
||||||
|
|
||||||
@ -637,16 +631,16 @@ protected:
|
|||||||
// May be accessed from any thread, protected
|
// May be accessed from any thread, protected
|
||||||
// by mEffectsLock.
|
// by mEffectsLock.
|
||||||
bool mShowsResizeIndicator;
|
bool mShowsResizeIndicator;
|
||||||
LayoutDeviceIntRect mResizeIndicatorRect;
|
nsIntRect mResizeIndicatorRect;
|
||||||
bool mHasRoundedBottomCorners;
|
bool mHasRoundedBottomCorners;
|
||||||
int mDevPixelCornerRadius;
|
int mDevPixelCornerRadius;
|
||||||
bool mIsCoveringTitlebar;
|
bool mIsCoveringTitlebar;
|
||||||
bool mIsFullscreen;
|
bool mIsFullscreen;
|
||||||
LayoutDeviceIntRect mTitlebarRect;
|
nsIntRect mTitlebarRect;
|
||||||
|
|
||||||
// The area of mTitlebarCGContext that needs to be redrawn during the next
|
// The area of mTitlebarCGContext that needs to be redrawn during the next
|
||||||
// transaction. Accessed from any thread, protected by mEffectsLock.
|
// transaction. Accessed from any thread, protected by mEffectsLock.
|
||||||
LayoutDeviceIntRegion mUpdatedTitlebarRegion;
|
nsIntRegion mUpdatedTitlebarRegion;
|
||||||
CGContextRef mTitlebarCGContext;
|
CGContextRef mTitlebarCGContext;
|
||||||
|
|
||||||
// Compositor thread only
|
// Compositor thread only
|
||||||
@ -659,7 +653,7 @@ protected:
|
|||||||
// uploaded to to mTitlebarImage. Main thread only.
|
// uploaded to to mTitlebarImage. Main thread only.
|
||||||
nsIntRegion mDirtyTitlebarRegion;
|
nsIntRegion mDirtyTitlebarRegion;
|
||||||
|
|
||||||
LayoutDeviceIntRegion mDraggableRegion;
|
nsIntRegion mDraggableRegion;
|
||||||
|
|
||||||
// Cached value of [mView backingScaleFactor], to avoid sending two obj-c
|
// Cached value of [mView backingScaleFactor], to avoid sending two obj-c
|
||||||
// messages (respondsToSelector, backingScaleFactor) every time we need to
|
// messages (respondsToSelector, backingScaleFactor) every time we need to
|
||||||
|
@ -93,8 +93,6 @@
|
|||||||
#include "VibrancyManager.h"
|
#include "VibrancyManager.h"
|
||||||
#include "nsNativeThemeCocoa.h"
|
#include "nsNativeThemeCocoa.h"
|
||||||
#include "nsIDOMWindowUtils.h"
|
#include "nsIDOMWindowUtils.h"
|
||||||
#include "Units.h"
|
|
||||||
#include "UnitTransforms.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::layers;
|
using namespace mozilla::layers;
|
||||||
@ -164,7 +162,7 @@ static uint32_t gNumberOfWidgetsNeedingEventThread = 0;
|
|||||||
- (void)processPendingRedraws;
|
- (void)processPendingRedraws;
|
||||||
|
|
||||||
- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext;
|
- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext;
|
||||||
- (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
|
- (nsIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
|
||||||
- (BOOL)isUsingMainThreadOpenGL;
|
- (BOOL)isUsingMainThreadOpenGL;
|
||||||
- (BOOL)isUsingOpenGL;
|
- (BOOL)isUsingOpenGL;
|
||||||
- (void)drawUsingOpenGL;
|
- (void)drawUsingOpenGL;
|
||||||
@ -193,7 +191,7 @@ static uint32_t gNumberOfWidgetsNeedingEventThread = 0;
|
|||||||
- (id<mozAccessible>)accessible;
|
- (id<mozAccessible>)accessible;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
- (LayoutDeviceIntPoint)convertWindowCoordinates:(NSPoint)aPoint;
|
- (nsIntPoint)convertWindowCoordinates:(NSPoint)aPoint;
|
||||||
- (APZCTreeManager*)apzctm;
|
- (APZCTreeManager*)apzctm;
|
||||||
|
|
||||||
- (BOOL)inactiveWindowAcceptsMouseEvent:(NSEvent*)aEvent;
|
- (BOOL)inactiveWindowAcceptsMouseEvent:(NSEvent*)aEvent;
|
||||||
@ -281,15 +279,13 @@ public:
|
|||||||
virtual ~RectTextureImage();
|
virtual ~RectTextureImage();
|
||||||
|
|
||||||
already_AddRefed<gfx::DrawTarget>
|
already_AddRefed<gfx::DrawTarget>
|
||||||
BeginUpdate(const LayoutDeviceIntSize& aNewSize,
|
BeginUpdate(const nsIntSize& aNewSize,
|
||||||
const LayoutDeviceIntRegion& aDirtyRegion =
|
const nsIntRegion& aDirtyRegion = nsIntRegion());
|
||||||
LayoutDeviceIntRegion());
|
|
||||||
void EndUpdate(bool aKeepSurface = false);
|
void EndUpdate(bool aKeepSurface = false);
|
||||||
|
|
||||||
void UpdateIfNeeded(const LayoutDeviceIntSize& aNewSize,
|
void UpdateIfNeeded(const nsIntSize& aNewSize,
|
||||||
const LayoutDeviceIntRegion& aDirtyRegion,
|
const nsIntRegion& aDirtyRegion,
|
||||||
void (^aCallback)(gfx::DrawTarget*,
|
void (^aCallback)(gfx::DrawTarget*, const nsIntRegion&))
|
||||||
const LayoutDeviceIntRegion&))
|
|
||||||
{
|
{
|
||||||
RefPtr<gfx::DrawTarget> drawTarget = BeginUpdate(aNewSize, aDirtyRegion);
|
RefPtr<gfx::DrawTarget> drawTarget = BeginUpdate(aNewSize, aDirtyRegion);
|
||||||
if (drawTarget) {
|
if (drawTarget) {
|
||||||
@ -298,30 +294,29 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateFromCGContext(const LayoutDeviceIntSize& aNewSize,
|
void UpdateFromCGContext(const nsIntSize& aNewSize,
|
||||||
const LayoutDeviceIntRegion& aDirtyRegion,
|
const nsIntRegion& aDirtyRegion,
|
||||||
CGContextRef aCGContext);
|
CGContextRef aCGContext);
|
||||||
|
|
||||||
LayoutDeviceIntRegion GetUpdateRegion() {
|
nsIntRegion GetUpdateRegion() {
|
||||||
MOZ_ASSERT(mInUpdate, "update region only valid during update");
|
MOZ_ASSERT(mInUpdate, "update region only valid during update");
|
||||||
return mUpdateRegion;
|
return mUpdateRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw(mozilla::layers::GLManager* aManager,
|
void Draw(mozilla::layers::GLManager* aManager,
|
||||||
const LayoutDeviceIntPoint& aLocation,
|
const nsIntPoint& aLocation,
|
||||||
const Matrix4x4& aTransform = Matrix4x4());
|
const Matrix4x4& aTransform = Matrix4x4());
|
||||||
|
|
||||||
static LayoutDeviceIntSize TextureSizeForSize(
|
static nsIntSize TextureSizeForSize(const nsIntSize& aSize);
|
||||||
const LayoutDeviceIntSize& aSize);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
RefPtr<gfx::DrawTarget> mUpdateDrawTarget;
|
RefPtr<gfx::DrawTarget> mUpdateDrawTarget;
|
||||||
GLContext* mGLContext;
|
GLContext* mGLContext;
|
||||||
LayoutDeviceIntRegion mUpdateRegion;
|
nsIntRegion mUpdateRegion;
|
||||||
LayoutDeviceIntSize mUsedSize;
|
nsIntSize mUsedSize;
|
||||||
LayoutDeviceIntSize mBufferSize;
|
nsIntSize mBufferSize;
|
||||||
LayoutDeviceIntSize mTextureSize;
|
nsIntSize mTextureSize;
|
||||||
GLuint mTexture;
|
GLuint mTexture;
|
||||||
bool mInUpdate;
|
bool mInUpdate;
|
||||||
};
|
};
|
||||||
@ -361,7 +356,7 @@ public:
|
|||||||
const gfx::Rect& aLayerRect,
|
const gfx::Rect& aLayerRect,
|
||||||
const gfx::Rect& aTextureRect) override;
|
const gfx::Rect& aTextureRect) override;
|
||||||
|
|
||||||
void BeginFrame(LayoutDeviceIntSize aRenderSize);
|
void BeginFrame(nsIntSize aRenderSize);
|
||||||
void EndFrame();
|
void EndFrame();
|
||||||
|
|
||||||
NSOpenGLContext* GetNSOpenGLContext()
|
NSOpenGLContext* GetNSOpenGLContext()
|
||||||
@ -518,8 +513,7 @@ nsresult nsChildView::Create(nsIWidget *aParent,
|
|||||||
// create our parallel NSView and hook it up to our parent. Recall
|
// create our parallel NSView and hook it up to our parent. Recall
|
||||||
// that NS_NATIVE_WIDGET is the NSView.
|
// that NS_NATIVE_WIDGET is the NSView.
|
||||||
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mParentView);
|
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mParentView);
|
||||||
NSRect r = nsCocoaUtils::DevPixelsToCocoaPoints(
|
NSRect r = nsCocoaUtils::DevPixelsToCocoaPoints(mBounds, scaleFactor);
|
||||||
LayoutDeviceIntRect::FromUnknownRect(mBounds), scaleFactor);
|
|
||||||
mView = [(NSView<mozView>*)CreateCocoaView(r) retain];
|
mView = [(NSView<mozView>*)CreateCocoaView(r) retain];
|
||||||
if (!mView) {
|
if (!mView) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -914,9 +908,13 @@ NS_IMETHODIMP nsChildView::SetCursor(imgIContainer* aCursor,
|
|||||||
// Get this component dimension
|
// Get this component dimension
|
||||||
NS_IMETHODIMP nsChildView::GetBounds(LayoutDeviceIntRect& aRect)
|
NS_IMETHODIMP nsChildView::GetBounds(LayoutDeviceIntRect& aRect)
|
||||||
{
|
{
|
||||||
aRect = !mView
|
nsIntRect tmp;
|
||||||
? LayoutDeviceIntRect::FromUnknownRect(mBounds)
|
if (!mView) {
|
||||||
: CocoaPointsToDevPixels([mView frame]);
|
tmp = mBounds;
|
||||||
|
} else {
|
||||||
|
tmp = CocoaPointsToDevPixels([mView frame]);
|
||||||
|
}
|
||||||
|
aRect = LayoutDeviceIntRect::FromUnknownRect(tmp);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1008,7 +1006,7 @@ NS_IMETHODIMP nsChildView::Move(double aX, double aY)
|
|||||||
mBounds.y = y;
|
mBounds.y = y;
|
||||||
|
|
||||||
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
||||||
[mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
|
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
||||||
});
|
});
|
||||||
|
|
||||||
NotifyRollupGeometryChange();
|
NotifyRollupGeometryChange();
|
||||||
@ -1033,7 +1031,7 @@ NS_IMETHODIMP nsChildView::Resize(double aWidth, double aHeight, bool aRepaint)
|
|||||||
mBounds.height = height;
|
mBounds.height = height;
|
||||||
|
|
||||||
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
||||||
[mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
|
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mVisible && aRepaint)
|
if (mVisible && aRepaint)
|
||||||
@ -1072,7 +1070,7 @@ NS_IMETHODIMP nsChildView::Resize(double aX, double aY,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
||||||
[mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
|
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mVisible && aRepaint)
|
if (mVisible && aRepaint)
|
||||||
@ -1094,7 +1092,7 @@ NS_IMETHODIMP nsChildView::Resize(double aX, double aY,
|
|||||||
|
|
||||||
static const int32_t resizeIndicatorWidth = 15;
|
static const int32_t resizeIndicatorWidth = 15;
|
||||||
static const int32_t resizeIndicatorHeight = 15;
|
static const int32_t resizeIndicatorHeight = 15;
|
||||||
bool nsChildView::ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect)
|
bool nsChildView::ShowsResizeIndicator(nsIntRect* aResizerRect)
|
||||||
{
|
{
|
||||||
NSView *topLevelView = mView, *superView = nil;
|
NSView *topLevelView = mView, *superView = nil;
|
||||||
while ((superView = [topLevelView superview]))
|
while ((superView = [topLevelView superview]))
|
||||||
@ -1366,10 +1364,10 @@ NS_IMETHODIMP nsChildView::Invalidate(const nsIntRect &aRect)
|
|||||||
if ([NSView focusView]) {
|
if ([NSView focusView]) {
|
||||||
// if a view is focussed (i.e. being drawn), then postpone the invalidate so that we
|
// if a view is focussed (i.e. being drawn), then postpone the invalidate so that we
|
||||||
// don't lose it.
|
// don't lose it.
|
||||||
[mView setNeedsPendingDisplayInRect:UntypedDevPixelsToCocoaPoints(aRect)];
|
[mView setNeedsPendingDisplayInRect:DevPixelsToCocoaPoints(aRect)];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[mView setNeedsDisplayInRect:UntypedDevPixelsToCocoaPoints(aRect)];
|
[mView setNeedsDisplayInRect:DevPixelsToCocoaPoints(aRect)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -1530,7 +1528,7 @@ LayoutDeviceIntPoint nsChildView::GetClientOffset()
|
|||||||
|
|
||||||
NSPoint origin = [mView convertPoint:NSMakePoint(0, 0) toView:nil];
|
NSPoint origin = [mView convertPoint:NSMakePoint(0, 0) toView:nil];
|
||||||
origin.y = [[mView window] frame].size.height - origin.y;
|
origin.y = [[mView window] frame].size.height - origin.y;
|
||||||
return CocoaPointsToDevPixels(origin);
|
return LayoutDeviceIntPoint::FromUnknownPoint(CocoaPointsToDevPixels(origin));
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
|
||||||
}
|
}
|
||||||
@ -1555,7 +1553,7 @@ LayoutDeviceIntPoint nsChildView::WidgetToScreenOffset()
|
|||||||
FlipCocoaScreenCoordinate(origin);
|
FlipCocoaScreenCoordinate(origin);
|
||||||
|
|
||||||
// convert to device pixels
|
// convert to device pixels
|
||||||
return CocoaPointsToDevPixels(origin);
|
return LayoutDeviceIntPoint::FromUnknownPoint(CocoaPointsToDevPixels(origin));
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
|
||||||
}
|
}
|
||||||
@ -1943,7 +1941,7 @@ nsChildView::ConfigureAPZControllerThread()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntRect
|
nsIntRect
|
||||||
nsChildView::RectContainingTitlebarControls()
|
nsChildView::RectContainingTitlebarControls()
|
||||||
{
|
{
|
||||||
// Start with a thin strip at the top of the window for the highlight line.
|
// Start with a thin strip at the top of the window for the highlight line.
|
||||||
@ -2017,8 +2015,7 @@ nsChildView::PostRender(LayerManagerComposite* aManager)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager,
|
nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
||||||
LayoutDeviceIntRect aRect)
|
|
||||||
{
|
{
|
||||||
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
|
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
|
||||||
if (manager) {
|
if (manager) {
|
||||||
@ -2027,20 +2024,20 @@ nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::DrawWindowOverlay(GLManager* aManager, LayoutDeviceIntRect aRect)
|
nsChildView::DrawWindowOverlay(GLManager* aManager, nsIntRect aRect)
|
||||||
{
|
{
|
||||||
GLContext* gl = aManager->gl();
|
GLContext* gl = aManager->gl();
|
||||||
ScopedGLState scopedScissorTestState(gl, LOCAL_GL_SCISSOR_TEST, false);
|
ScopedGLState scopedScissorTestState(gl, LOCAL_GL_SCISSOR_TEST, false);
|
||||||
|
|
||||||
MaybeDrawTitlebar(aManager);
|
MaybeDrawTitlebar(aManager, aRect);
|
||||||
MaybeDrawResizeIndicator(aManager);
|
MaybeDrawResizeIndicator(aManager, aRect);
|
||||||
MaybeDrawRoundedCorners(aManager, aRect);
|
MaybeDrawRoundedCorners(aManager, aRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ClearRegion(gfx::DrawTarget *aDT, LayoutDeviceIntRegion aRegion)
|
ClearRegion(gfx::DrawTarget *aDT, nsIntRegion aRegion)
|
||||||
{
|
{
|
||||||
gfxUtils::ClipToRegion(aDT, aRegion.ToUnknownRegion());
|
gfxUtils::ClipToRegion(aDT, aRegion);
|
||||||
aDT->ClearRect(gfx::Rect(0, 0, aDT->GetSize().width, aDT->GetSize().height));
|
aDT->ClearRect(gfx::Rect(0, 0, aDT->GetSize().width, aDT->GetSize().height));
|
||||||
aDT->PopClip();
|
aDT->PopClip();
|
||||||
}
|
}
|
||||||
@ -2079,7 +2076,7 @@ DrawResizer(CGContextRef aCtx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::MaybeDrawResizeIndicator(GLManager* aManager)
|
nsChildView::MaybeDrawResizeIndicator(GLManager* aManager, const nsIntRect& aRect)
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mEffectsLock);
|
MutexAutoLock lock(mEffectsLock);
|
||||||
if (!mShowsResizeIndicator) {
|
if (!mShowsResizeIndicator) {
|
||||||
@ -2090,8 +2087,8 @@ nsChildView::MaybeDrawResizeIndicator(GLManager* aManager)
|
|||||||
mResizerImage = new RectTextureImage(aManager->gl());
|
mResizerImage = new RectTextureImage(aManager->gl());
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntSize size = mResizeIndicatorRect.Size();
|
nsIntSize size = mResizeIndicatorRect.Size();
|
||||||
mResizerImage->UpdateIfNeeded(size, LayoutDeviceIntRegion(), ^(gfx::DrawTarget* drawTarget, const LayoutDeviceIntRegion& updateRegion) {
|
mResizerImage->UpdateIfNeeded(size, nsIntRegion(), ^(gfx::DrawTarget* drawTarget, const nsIntRegion& updateRegion) {
|
||||||
ClearRegion(drawTarget, updateRegion);
|
ClearRegion(drawTarget, updateRegion);
|
||||||
gfx::BorrowedCGContext borrow(drawTarget);
|
gfx::BorrowedCGContext borrow(drawTarget);
|
||||||
DrawResizer(borrow.cg);
|
DrawResizer(borrow.cg);
|
||||||
@ -2134,7 +2131,7 @@ DrawTitlebarHighlight(NSSize aWindowSize, CGFloat aRadius, CGFloat aDevicePixelW
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CGContextRef
|
static CGContextRef
|
||||||
CreateCGContext(const LayoutDeviceIntSize& aSize)
|
CreateCGContext(const nsIntSize& aSize)
|
||||||
{
|
{
|
||||||
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
|
||||||
CGContextRef ctx =
|
CGContextRef ctx =
|
||||||
@ -2167,8 +2164,7 @@ nsChildView::UpdateTitlebarCGContext()
|
|||||||
NSRect dirtyRect = [mView convertRect:[(BaseWindow*)[mView window] getAndResetNativeDirtyRect] fromView:nil];
|
NSRect dirtyRect = [mView convertRect:[(BaseWindow*)[mView window] getAndResetNativeDirtyRect] fromView:nil];
|
||||||
NSRect dirtyTitlebarRect = NSIntersectionRect(titlebarRect, dirtyRect);
|
NSRect dirtyTitlebarRect = NSIntersectionRect(titlebarRect, dirtyRect);
|
||||||
|
|
||||||
LayoutDeviceIntSize texSize =
|
nsIntSize texSize = RectTextureImage::TextureSizeForSize(mTitlebarRect.Size());
|
||||||
RectTextureImage::TextureSizeForSize(mTitlebarRect.Size());
|
|
||||||
if (!mTitlebarCGContext ||
|
if (!mTitlebarCGContext ||
|
||||||
CGBitmapContextGetWidth(mTitlebarCGContext) != size_t(texSize.width) ||
|
CGBitmapContextGetWidth(mTitlebarCGContext) != size_t(texSize.width) ||
|
||||||
CGBitmapContextGetHeight(mTitlebarCGContext) != size_t(texSize.height)) {
|
CGBitmapContextGetHeight(mTitlebarCGContext) != size_t(texSize.height)) {
|
||||||
@ -2289,14 +2285,14 @@ nsChildView::UpdateTitlebarCGContext()
|
|||||||
// GLContext surface. In order to make the titlebar controls visible, we have
|
// GLContext surface. In order to make the titlebar controls visible, we have
|
||||||
// to redraw them inside the OpenGL context surface.
|
// to redraw them inside the OpenGL context surface.
|
||||||
void
|
void
|
||||||
nsChildView::MaybeDrawTitlebar(GLManager* aManager)
|
nsChildView::MaybeDrawTitlebar(GLManager* aManager, const nsIntRect& aRect)
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mEffectsLock);
|
MutexAutoLock lock(mEffectsLock);
|
||||||
if (!mIsCoveringTitlebar || mIsFullscreen) {
|
if (!mIsCoveringTitlebar || mIsFullscreen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntRegion updatedTitlebarRegion;
|
nsIntRegion updatedTitlebarRegion;
|
||||||
updatedTitlebarRegion.And(mUpdatedTitlebarRegion, mTitlebarRect);
|
updatedTitlebarRegion.And(mUpdatedTitlebarRegion, mTitlebarRect);
|
||||||
mUpdatedTitlebarRegion.SetEmpty();
|
mUpdatedTitlebarRegion.SetEmpty();
|
||||||
|
|
||||||
@ -2319,8 +2315,7 @@ DrawTopLeftCornerMask(CGContextRef aCtx, int aRadius)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::MaybeDrawRoundedCorners(GLManager* aManager,
|
nsChildView::MaybeDrawRoundedCorners(GLManager* aManager, const nsIntRect& aRect)
|
||||||
const LayoutDeviceIntRect& aRect)
|
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mEffectsLock);
|
MutexAutoLock lock(mEffectsLock);
|
||||||
|
|
||||||
@ -2328,8 +2323,8 @@ nsChildView::MaybeDrawRoundedCorners(GLManager* aManager,
|
|||||||
mCornerMaskImage = new RectTextureImage(aManager->gl());
|
mCornerMaskImage = new RectTextureImage(aManager->gl());
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntSize size(mDevPixelCornerRadius, mDevPixelCornerRadius);
|
nsIntSize size(mDevPixelCornerRadius, mDevPixelCornerRadius);
|
||||||
mCornerMaskImage->UpdateIfNeeded(size, LayoutDeviceIntRegion(), ^(gfx::DrawTarget* drawTarget, const LayoutDeviceIntRegion& updateRegion) {
|
mCornerMaskImage->UpdateIfNeeded(size, nsIntRegion(), ^(gfx::DrawTarget* drawTarget, const nsIntRegion& updateRegion) {
|
||||||
ClearRegion(drawTarget, updateRegion);
|
ClearRegion(drawTarget, updateRegion);
|
||||||
RefPtr<gfx::PathBuilder> builder = drawTarget->CreatePathBuilder();
|
RefPtr<gfx::PathBuilder> builder = drawTarget->CreatePathBuilder();
|
||||||
builder->Arc(gfx::Point(mDevPixelCornerRadius, mDevPixelCornerRadius), mDevPixelCornerRadius, 0, 2.0f * M_PI);
|
builder->Arc(gfx::Point(mDevPixelCornerRadius, mDevPixelCornerRadius), mDevPixelCornerRadius, 0, 2.0f * M_PI);
|
||||||
@ -2397,17 +2392,17 @@ FindUnifiedToolbarBottom(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometr
|
|||||||
return unifiedToolbarBottom;
|
return unifiedToolbarBottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LayoutDeviceIntRect
|
static nsIntRect
|
||||||
FindFirstRectOfType(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometries,
|
FindFirstRectOfType(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometries,
|
||||||
nsITheme::ThemeGeometryType aThemeGeometryType)
|
nsITheme::ThemeGeometryType aThemeGeometryType)
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < aThemeGeometries.Length(); ++i) {
|
for (uint32_t i = 0; i < aThemeGeometries.Length(); ++i) {
|
||||||
const nsIWidget::ThemeGeometry& g = aThemeGeometries[i];
|
const nsIWidget::ThemeGeometry& g = aThemeGeometries[i];
|
||||||
if (g.mType == aThemeGeometryType) {
|
if (g.mType == aThemeGeometryType) {
|
||||||
return LayoutDeviceIntRect::FromUnknownRect(g.mRect);
|
return g.mRect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return LayoutDeviceIntRect();
|
return nsIntRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2439,9 +2434,9 @@ nsChildView::UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometri
|
|||||||
[win setSheetAttachmentPosition:DevPixelsToCocoaPoints(devSheetPosition)];
|
[win setSheetAttachmentPosition:DevPixelsToCocoaPoints(devSheetPosition)];
|
||||||
|
|
||||||
// Update titlebar control offsets.
|
// Update titlebar control offsets.
|
||||||
LayoutDeviceIntRect windowButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeWindowButtons);
|
nsIntRect windowButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeWindowButtons);
|
||||||
[win placeWindowButtons:[mView convertRect:DevPixelsToCocoaPoints(windowButtonRect) toView:nil]];
|
[win placeWindowButtons:[mView convertRect:DevPixelsToCocoaPoints(windowButtonRect) toView:nil]];
|
||||||
LayoutDeviceIntRect fullScreenButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeFullscreenButton);
|
nsIntRect fullScreenButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeFullscreenButton);
|
||||||
[win placeFullScreenButton:[mView convertRect:DevPixelsToCocoaPoints(fullScreenButtonRect) toView:nil]];
|
[win placeFullScreenButton:[mView convertRect:DevPixelsToCocoaPoints(fullScreenButtonRect) toView:nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2637,9 +2632,8 @@ nsChildView::StartRemoteDrawing()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntRegion dirtyRegion(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
nsIntRegion dirtyRegion = mBounds;
|
||||||
LayoutDeviceIntSize renderSize =
|
nsIntSize renderSize = mBounds.Size();
|
||||||
LayoutDeviceIntSize::FromUnknownSize(mBounds.Size());
|
|
||||||
|
|
||||||
if (!mBasicCompositorImage) {
|
if (!mBasicCompositorImage) {
|
||||||
mBasicCompositorImage = new RectTextureImage(mGLPresenter->gl());
|
mBasicCompositorImage = new RectTextureImage(mGLPresenter->gl());
|
||||||
@ -2650,7 +2644,7 @@ nsChildView::StartRemoteDrawing()
|
|||||||
|
|
||||||
if (!drawTarget) {
|
if (!drawTarget) {
|
||||||
// Composite unchanged textures.
|
// Composite unchanged textures.
|
||||||
DoRemoteComposition(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
DoRemoteComposition(mBounds);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2661,7 +2655,7 @@ void
|
|||||||
nsChildView::EndRemoteDrawing()
|
nsChildView::EndRemoteDrawing()
|
||||||
{
|
{
|
||||||
mBasicCompositorImage->EndUpdate(true);
|
mBasicCompositorImage->EndUpdate(true);
|
||||||
DoRemoteComposition(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
DoRemoteComposition(mBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2688,7 +2682,7 @@ nsChildView::InitCompositor(Compositor* aCompositor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect)
|
nsChildView::DoRemoteComposition(const nsIntRect& aRenderRect)
|
||||||
{
|
{
|
||||||
if (![(ChildView*)mView preRender:mGLPresenter->GetNSOpenGLContext()]) {
|
if (![(ChildView*)mView preRender:mGLPresenter->GetNSOpenGLContext()]) {
|
||||||
return;
|
return;
|
||||||
@ -2696,7 +2690,7 @@ nsChildView::DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect)
|
|||||||
mGLPresenter->BeginFrame(aRenderRect.Size());
|
mGLPresenter->BeginFrame(aRenderRect.Size());
|
||||||
|
|
||||||
// Draw the result from the basic compositor.
|
// Draw the result from the basic compositor.
|
||||||
mBasicCompositorImage->Draw(mGLPresenter, LayoutDeviceIntPoint(0, 0));
|
mBasicCompositorImage->Draw(mGLPresenter, nsIntPoint(0, 0));
|
||||||
|
|
||||||
// DrawWindowOverlay doesn't do anything for non-GL, so it didn't paint
|
// DrawWindowOverlay doesn't do anything for non-GL, so it didn't paint
|
||||||
// anything during the basic compositor transaction. Draw the overlay now.
|
// anything during the basic compositor transaction. Draw the overlay now.
|
||||||
@ -2710,10 +2704,8 @@ nsChildView::DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect)
|
|||||||
void
|
void
|
||||||
nsChildView::UpdateWindowDraggingRegion(const nsIntRegion& aRegion)
|
nsChildView::UpdateWindowDraggingRegion(const nsIntRegion& aRegion)
|
||||||
{
|
{
|
||||||
LayoutDeviceIntRegion region =
|
if (mDraggableRegion != aRegion) {
|
||||||
LayoutDeviceIntRegion::FromUnknownRegion(aRegion);
|
mDraggableRegion = aRegion;
|
||||||
if (mDraggableRegion != region) {
|
|
||||||
mDraggableRegion = region;
|
|
||||||
[(ChildView*)mView updateWindowDraggableState];
|
[(ChildView*)mView updateWindowDraggableState];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2883,30 +2875,29 @@ RectTextureImage::~RectTextureImage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntSize
|
nsIntSize
|
||||||
RectTextureImage::TextureSizeForSize(const LayoutDeviceIntSize& aSize)
|
RectTextureImage::TextureSizeForSize(const nsIntSize& aSize)
|
||||||
{
|
{
|
||||||
return LayoutDeviceIntSize(gfx::NextPowerOfTwo(aSize.width),
|
return nsIntSize(gfx::NextPowerOfTwo(aSize.width),
|
||||||
gfx::NextPowerOfTwo(aSize.height));
|
gfx::NextPowerOfTwo(aSize.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<gfx::DrawTarget>
|
already_AddRefed<gfx::DrawTarget>
|
||||||
RectTextureImage::BeginUpdate(const LayoutDeviceIntSize& aNewSize,
|
RectTextureImage::BeginUpdate(const nsIntSize& aNewSize,
|
||||||
const LayoutDeviceIntRegion& aDirtyRegion)
|
const nsIntRegion& aDirtyRegion)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!mInUpdate, "Beginning update during update!");
|
MOZ_ASSERT(!mInUpdate, "Beginning update during update!");
|
||||||
mUpdateRegion = aDirtyRegion;
|
mUpdateRegion = aDirtyRegion;
|
||||||
if (aNewSize != mUsedSize) {
|
if (aNewSize != mUsedSize) {
|
||||||
mUsedSize = aNewSize;
|
mUsedSize = aNewSize;
|
||||||
mUpdateRegion =
|
mUpdateRegion = gfx::IntRect(gfx::IntPoint(0, 0), aNewSize);
|
||||||
LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0), aNewSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mUpdateRegion.IsEmpty()) {
|
if (mUpdateRegion.IsEmpty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntSize neededBufferSize = TextureSizeForSize(mUsedSize);
|
nsIntSize neededBufferSize = TextureSizeForSize(mUsedSize);
|
||||||
if (!mUpdateDrawTarget || mBufferSize != neededBufferSize) {
|
if (!mUpdateDrawTarget || mBufferSize != neededBufferSize) {
|
||||||
gfx::IntSize size(neededBufferSize.width, neededBufferSize.height);
|
gfx::IntSize size(neededBufferSize.width, neededBufferSize.height);
|
||||||
mUpdateDrawTarget =
|
mUpdateDrawTarget =
|
||||||
@ -2935,15 +2926,14 @@ RectTextureImage::EndUpdate(bool aKeepSurface)
|
|||||||
MOZ_ASSERT(mInUpdate, "Ending update while not in update");
|
MOZ_ASSERT(mInUpdate, "Ending update while not in update");
|
||||||
|
|
||||||
bool overwriteTexture = false;
|
bool overwriteTexture = false;
|
||||||
LayoutDeviceIntRegion updateRegion = mUpdateRegion;
|
nsIntRegion updateRegion = mUpdateRegion;
|
||||||
if (!mTexture || (mTextureSize != mBufferSize)) {
|
if (!mTexture || (mTextureSize != mBufferSize)) {
|
||||||
overwriteTexture = true;
|
overwriteTexture = true;
|
||||||
mTextureSize = mBufferSize;
|
mTextureSize = mBufferSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overwriteTexture || !CanUploadSubtextures()) {
|
if (overwriteTexture || !CanUploadSubtextures()) {
|
||||||
updateRegion =
|
updateRegion = gfx::IntRect(gfx::IntPoint(0, 0), mTextureSize);
|
||||||
LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0), mTextureSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<gfx::SourceSurface> snapshot = mUpdateDrawTarget->Snapshot();
|
RefPtr<gfx::SourceSurface> snapshot = mUpdateDrawTarget->Snapshot();
|
||||||
@ -2951,10 +2941,10 @@ RectTextureImage::EndUpdate(bool aKeepSurface)
|
|||||||
|
|
||||||
UploadSurfaceToTexture(mGLContext,
|
UploadSurfaceToTexture(mGLContext,
|
||||||
dataSnapshot,
|
dataSnapshot,
|
||||||
updateRegion.ToUnknownRegion(),
|
updateRegion,
|
||||||
mTexture,
|
mTexture,
|
||||||
overwriteTexture,
|
overwriteTexture,
|
||||||
updateRegion.GetBounds().TopLeft().ToUnknownPoint(),
|
updateRegion.GetBounds().TopLeft(),
|
||||||
false,
|
false,
|
||||||
LOCAL_GL_TEXTURE0,
|
LOCAL_GL_TEXTURE0,
|
||||||
LOCAL_GL_TEXTURE_RECTANGLE_ARB);
|
LOCAL_GL_TEXTURE_RECTANGLE_ARB);
|
||||||
@ -2967,8 +2957,8 @@ RectTextureImage::EndUpdate(bool aKeepSurface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RectTextureImage::UpdateFromCGContext(const LayoutDeviceIntSize& aNewSize,
|
RectTextureImage::UpdateFromCGContext(const nsIntSize& aNewSize,
|
||||||
const LayoutDeviceIntRegion& aDirtyRegion,
|
const nsIntRegion& aDirtyRegion,
|
||||||
CGContextRef aCGContext)
|
CGContextRef aCGContext)
|
||||||
{
|
{
|
||||||
gfx::IntSize size = gfx::IntSize(CGBitmapContextGetWidth(aCGContext),
|
gfx::IntSize size = gfx::IntSize(CGBitmapContextGetWidth(aCGContext),
|
||||||
@ -2977,7 +2967,7 @@ RectTextureImage::UpdateFromCGContext(const LayoutDeviceIntSize& aNewSize,
|
|||||||
RefPtr<gfx::DrawTarget> dt = BeginUpdate(aNewSize, aDirtyRegion);
|
RefPtr<gfx::DrawTarget> dt = BeginUpdate(aNewSize, aDirtyRegion);
|
||||||
if (dt) {
|
if (dt) {
|
||||||
gfx::Rect rect(0, 0, size.width, size.height);
|
gfx::Rect rect(0, 0, size.width, size.height);
|
||||||
gfxUtils::ClipToRegion(dt, GetUpdateRegion().ToUnknownRegion());
|
gfxUtils::ClipToRegion(dt, GetUpdateRegion());
|
||||||
RefPtr<gfx::SourceSurface> sourceSurface =
|
RefPtr<gfx::SourceSurface> sourceSurface =
|
||||||
dt->CreateSourceSurfaceFromData(static_cast<uint8_t *>(CGBitmapContextGetData(aCGContext)),
|
dt->CreateSourceSurfaceFromData(static_cast<uint8_t *>(CGBitmapContextGetData(aCGContext)),
|
||||||
size,
|
size,
|
||||||
@ -2993,7 +2983,7 @@ RectTextureImage::UpdateFromCGContext(const LayoutDeviceIntSize& aNewSize,
|
|||||||
|
|
||||||
void
|
void
|
||||||
RectTextureImage::Draw(GLManager* aManager,
|
RectTextureImage::Draw(GLManager* aManager,
|
||||||
const LayoutDeviceIntPoint& aLocation,
|
const nsIntPoint& aLocation,
|
||||||
const Matrix4x4& aTransform)
|
const Matrix4x4& aTransform)
|
||||||
{
|
{
|
||||||
ShaderProgramOGL* program = aManager->GetProgram(LOCAL_GL_TEXTURE_RECTANGLE_ARB,
|
ShaderProgramOGL* program = aManager->GetProgram(LOCAL_GL_TEXTURE_RECTANGLE_ARB,
|
||||||
@ -3086,7 +3076,7 @@ GLPresenter::BindAndDrawQuad(ShaderProgramOGL *aProgram,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GLPresenter::BeginFrame(LayoutDeviceIntSize aRenderSize)
|
GLPresenter::BeginFrame(nsIntSize aRenderSize)
|
||||||
{
|
{
|
||||||
mGLContext->MakeCurrent();
|
mGLContext->MakeCurrent();
|
||||||
|
|
||||||
@ -3620,9 +3610,9 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
return mGeckoChild->VibrancyFontSmoothingBackgroundColorForThemeGeometryType(aThemeGeometryType);
|
return mGeckoChild->VibrancyFontSmoothingBackgroundColorForThemeGeometryType(aThemeGeometryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect
|
- (nsIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect
|
||||||
{
|
{
|
||||||
LayoutDeviceIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
|
nsIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
|
||||||
const NSRect *rects;
|
const NSRect *rects;
|
||||||
NSInteger count;
|
NSInteger count;
|
||||||
[self getRectsBeingDrawn:&rects count:&count];
|
[self getRectsBeingDrawn:&rects count:&count];
|
||||||
@ -3631,7 +3621,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
return boundingRect;
|
return boundingRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntRegion region;
|
nsIntRegion region;
|
||||||
for (NSInteger i = 0; i < count; ++i) {
|
for (NSInteger i = 0; i < count; ++i) {
|
||||||
region.Or(region, mGeckoChild->CocoaPointsToDevPixels(rects[i]));
|
region.Or(region, mGeckoChild->CocoaPointsToDevPixels(rects[i]));
|
||||||
}
|
}
|
||||||
@ -3708,7 +3698,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
|
|
||||||
CGContextSaveGState(aContext);
|
CGContextSaveGState(aContext);
|
||||||
|
|
||||||
LayoutDeviceIntRegion region = [self nativeDirtyRegionWithBoundingRect:aRect];
|
nsIntRegion region = [self nativeDirtyRegionWithBoundingRect:aRect];
|
||||||
|
|
||||||
// Create Cairo objects.
|
// Create Cairo objects.
|
||||||
RefPtr<gfxQuartzSurface> targetSurface;
|
RefPtr<gfxQuartzSurface> targetSurface;
|
||||||
@ -3722,7 +3712,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
RefPtr<gfxContext> targetContext = new gfxContext(dt);
|
RefPtr<gfxContext> targetContext = new gfxContext(dt);
|
||||||
|
|
||||||
// Set up the clip region.
|
// Set up the clip region.
|
||||||
nsIntRegionRectIterator iter(region.ToUnknownRegion());
|
nsIntRegionRectIterator iter(region);
|
||||||
targetContext->NewPath();
|
targetContext->NewPath();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const nsIntRect* r = iter.Next();
|
const nsIntRect* r = iter.Next();
|
||||||
@ -3737,10 +3727,10 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_BASIC) {
|
if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_BASIC) {
|
||||||
nsBaseWidget::AutoLayerManagerSetup
|
nsBaseWidget::AutoLayerManagerSetup
|
||||||
setupLayerManager(mGeckoChild, targetContext, BufferMode::BUFFER_NONE);
|
setupLayerManager(mGeckoChild, targetContext, BufferMode::BUFFER_NONE);
|
||||||
painted = mGeckoChild->PaintWindow(region.ToUnknownRegion());
|
painted = mGeckoChild->PaintWindow(region);
|
||||||
} else if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
|
} else if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
|
||||||
// We only need this so that we actually get DidPaintWindow fired
|
// We only need this so that we actually get DidPaintWindow fired
|
||||||
painted = mGeckoChild->PaintWindow(region.ToUnknownRegion());
|
painted = mGeckoChild->PaintWindow(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
targetContext = nullptr;
|
targetContext = nullptr;
|
||||||
@ -4570,7 +4560,8 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
|
|
||||||
EventMessage msg = aEnter ? eMouseEnterIntoWidget : eMouseExitFromWidget;
|
EventMessage msg = aEnter ? eMouseEnterIntoWidget : eMouseExitFromWidget;
|
||||||
WidgetMouseEvent event(true, msg, mGeckoChild, WidgetMouseEvent::eReal);
|
WidgetMouseEvent event(true, msg, mGeckoChild, WidgetMouseEvent::eReal);
|
||||||
event.refPoint = mGeckoChild->CocoaPointsToDevPixels(localEventLocation);
|
event.refPoint = LayoutDeviceIntPoint::FromUnknownPoint(
|
||||||
|
mGeckoChild->CocoaPointsToDevPixels(localEventLocation));
|
||||||
|
|
||||||
event.exit = aType;
|
event.exit = aType;
|
||||||
|
|
||||||
@ -4598,7 +4589,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
|
|
||||||
static CGSRegionObj
|
static CGSRegionObj
|
||||||
NewCGSRegionFromRegion(const nsIntRegion& aRegion,
|
NewCGSRegionFromRegion(const nsIntRegion& aRegion,
|
||||||
CGRect (^aRectConverter)(const LayoutDeviceIntRect&))
|
CGRect (^aRectConverter)(const nsIntRect&))
|
||||||
{
|
{
|
||||||
nsTArray<CGRect> rects;
|
nsTArray<CGRect> rects;
|
||||||
nsIntRegionRectIterator iter(aRegion);
|
nsIntRegionRectIterator iter(aRegion);
|
||||||
@ -4606,7 +4597,7 @@ NewCGSRegionFromRegion(const nsIntRegion& aRegion,
|
|||||||
const nsIntRect* r = iter.Next();
|
const nsIntRect* r = iter.Next();
|
||||||
if (!r)
|
if (!r)
|
||||||
break;
|
break;
|
||||||
rects.AppendElement(aRectConverter(LayoutDeviceIntRect::FromUnknownRect(*r)));
|
rects.AppendElement(aRectConverter(*r));
|
||||||
}
|
}
|
||||||
|
|
||||||
CGSRegionObj region;
|
CGSRegionObj region;
|
||||||
@ -4624,12 +4615,12 @@ NewCGSRegionFromRegion(const nsIntRegion& aRegion,
|
|||||||
return [super _regionForOpaqueDescendants:aRect forMove:aForMove];
|
return [super _regionForOpaqueDescendants:aRect forMove:aForMove];
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
|
nsIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
|
||||||
|
|
||||||
LayoutDeviceIntRegion opaqueRegion;
|
nsIntRegion opaqueRegion;
|
||||||
opaqueRegion.Sub(boundingRect, mGeckoChild->GetDraggableRegion());
|
opaqueRegion.Sub(boundingRect, mGeckoChild->GetDraggableRegion());
|
||||||
|
|
||||||
return NewCGSRegionFromRegion(opaqueRegion.ToUnknownRegion(), ^(const LayoutDeviceIntRect& r) {
|
return NewCGSRegionFromRegion(opaqueRegion, ^(const nsIntRect& r) {
|
||||||
return [self convertToFlippedWindowCoordinates:mGeckoChild->DevPixelsToCocoaPoints(r)];
|
return [self convertToFlippedWindowCoordinates:mGeckoChild->DevPixelsToCocoaPoints(r)];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -4901,9 +4892,8 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
|||||||
|
|
||||||
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(theEvent, [self window]);
|
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(theEvent, [self window]);
|
||||||
|
|
||||||
ScreenPoint position = ViewAs<ScreenPixel>(
|
ScreenPoint position = ScreenPoint::FromUnknownPoint(
|
||||||
[self convertWindowCoordinates:locationInWindow],
|
[self convertWindowCoordinates:locationInWindow]);
|
||||||
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
|
|
||||||
|
|
||||||
bool usePreciseDeltas = nsCocoaUtils::HasPreciseScrollingDeltas(theEvent) &&
|
bool usePreciseDeltas = nsCocoaUtils::HasPreciseScrollingDeltas(theEvent) &&
|
||||||
Preferences::GetBool("mousewheel.enable_pixel_scrolling", true);
|
Preferences::GetBool("mousewheel.enable_pixel_scrolling", true);
|
||||||
@ -4977,9 +4967,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
|||||||
CGPoint loc = CGEventGetLocation(cgEvent);
|
CGPoint loc = CGEventGetLocation(cgEvent);
|
||||||
loc.y = nsCocoaUtils::FlippedScreenY(loc.y);
|
loc.y = nsCocoaUtils::FlippedScreenY(loc.y);
|
||||||
NSPoint locationInWindow = [[self window] convertScreenToBase:NSPointFromCGPoint(loc)];
|
NSPoint locationInWindow = [[self window] convertScreenToBase:NSPointFromCGPoint(loc)];
|
||||||
ScreenIntPoint location = ViewAs<ScreenPixel>(
|
ScreenIntPoint location = ScreenIntPoint::FromUnknownPoint([self convertWindowCoordinates:locationInWindow]);
|
||||||
[self convertWindowCoordinates:locationInWindow],
|
|
||||||
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
|
|
||||||
|
|
||||||
static NSTimeInterval sStartTime = [NSDate timeIntervalSinceReferenceDate];
|
static NSTimeInterval sStartTime = [NSDate timeIntervalSinceReferenceDate];
|
||||||
static TimeStamp sStartTimeStamp = TimeStamp::Now();
|
static TimeStamp sStartTimeStamp = TimeStamp::Now();
|
||||||
@ -4996,9 +4984,8 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
|||||||
NSPoint locationInWindowMoved = NSMakePoint(
|
NSPoint locationInWindowMoved = NSMakePoint(
|
||||||
locationInWindow.x + pixelDeltaX,
|
locationInWindow.x + pixelDeltaX,
|
||||||
locationInWindow.y - pixelDeltaY);
|
locationInWindow.y - pixelDeltaY);
|
||||||
ScreenIntPoint locationMoved = ViewAs<ScreenPixel>(
|
ScreenIntPoint locationMoved = ScreenIntPoint::FromUnknownPoint(
|
||||||
[self convertWindowCoordinates:locationInWindowMoved],
|
[self convertWindowCoordinates:locationInWindowMoved]);
|
||||||
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
|
|
||||||
ScreenPoint delta = ScreenPoint(locationMoved - location);
|
ScreenPoint delta = ScreenPoint(locationMoved - location);
|
||||||
ScrollableLayerGuid guid;
|
ScrollableLayerGuid guid;
|
||||||
|
|
||||||
@ -5144,7 +5131,8 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
|||||||
// convert point to view coordinate system
|
// convert point to view coordinate system
|
||||||
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(aMouseEvent, [self window]);
|
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(aMouseEvent, [self window]);
|
||||||
|
|
||||||
outGeckoEvent->refPoint = [self convertWindowCoordinates:locationInWindow];
|
outGeckoEvent->refPoint = LayoutDeviceIntPoint::FromUnknownPoint(
|
||||||
|
[self convertWindowCoordinates:locationInWindow]);
|
||||||
|
|
||||||
WidgetMouseEventBase* mouseEvent = outGeckoEvent->AsMouseEventBase();
|
WidgetMouseEventBase* mouseEvent = outGeckoEvent->AsMouseEventBase();
|
||||||
mouseEvent->buttons = 0;
|
mouseEvent->buttons = 0;
|
||||||
@ -5594,10 +5582,10 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
|||||||
return NSDragOperationNone;
|
return NSDragOperationNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LayoutDeviceIntPoint)convertWindowCoordinates:(NSPoint)aPoint
|
- (nsIntPoint)convertWindowCoordinates:(NSPoint)aPoint
|
||||||
{
|
{
|
||||||
if (!mGeckoChild) {
|
if (!mGeckoChild) {
|
||||||
return LayoutDeviceIntPoint(0, 0);
|
return nsIntPoint(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NSPoint localPoint = [self convertPoint:aPoint fromView:nil];
|
NSPoint localPoint = [self convertPoint:aPoint fromView:nil];
|
||||||
@ -5676,7 +5664,8 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
|||||||
// Convert event from gecko global coords to gecko view coords.
|
// Convert event from gecko global coords to gecko view coords.
|
||||||
NSPoint draggingLoc = [aSender draggingLocation];
|
NSPoint draggingLoc = [aSender draggingLocation];
|
||||||
|
|
||||||
geckoEvent.refPoint = [self convertWindowCoordinates:draggingLoc];
|
geckoEvent.refPoint = LayoutDeviceIntPoint::FromUnknownPoint(
|
||||||
|
[self convertWindowCoordinates:draggingLoc]);
|
||||||
|
|
||||||
nsAutoRetainCocoaObject kungFuDeathGrip(self);
|
nsAutoRetainCocoaObject kungFuDeathGrip(self);
|
||||||
mGeckoChild->DispatchInputEvent(&geckoEvent);
|
mGeckoChild->DispatchInputEvent(&geckoEvent);
|
||||||
@ -5782,7 +5771,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
|||||||
NSPoint pnt = [NSEvent mouseLocation];
|
NSPoint pnt = [NSEvent mouseLocation];
|
||||||
FlipCocoaScreenCoordinate(pnt);
|
FlipCocoaScreenCoordinate(pnt);
|
||||||
|
|
||||||
LayoutDeviceIntPoint devPoint = mGeckoChild->CocoaPointsToDevPixels(pnt);
|
nsIntPoint devPoint = mGeckoChild->CocoaPointsToDevPixels(pnt);
|
||||||
dragService->DragMoved(devPoint.x, devPoint.y);
|
dragService->DragMoved(devPoint.x, devPoint.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,6 @@ struct KeyBindingsCommand
|
|||||||
class nsCocoaUtils
|
class nsCocoaUtils
|
||||||
{
|
{
|
||||||
typedef mozilla::gfx::SourceSurface SourceSurface;
|
typedef mozilla::gfx::SourceSurface SourceSurface;
|
||||||
typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
|
|
||||||
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -154,20 +152,20 @@ public:
|
|||||||
return NSToIntRound(aPts * aBackingScale);
|
return NSToIntRound(aPts * aBackingScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LayoutDeviceIntPoint
|
static nsIntPoint
|
||||||
CocoaPointsToDevPixels(const NSPoint& aPt, CGFloat aBackingScale)
|
CocoaPointsToDevPixels(const NSPoint& aPt, CGFloat aBackingScale)
|
||||||
{
|
{
|
||||||
return LayoutDeviceIntPoint(NSToIntRound(aPt.x * aBackingScale),
|
return nsIntPoint(NSToIntRound(aPt.x * aBackingScale),
|
||||||
NSToIntRound(aPt.y * aBackingScale));
|
NSToIntRound(aPt.y * aBackingScale));
|
||||||
}
|
}
|
||||||
|
|
||||||
static LayoutDeviceIntRect
|
static nsIntRect
|
||||||
CocoaPointsToDevPixels(const NSRect& aRect, CGFloat aBackingScale)
|
CocoaPointsToDevPixels(const NSRect& aRect, CGFloat aBackingScale)
|
||||||
{
|
{
|
||||||
return LayoutDeviceIntRect(NSToIntRound(aRect.origin.x * aBackingScale),
|
return nsIntRect(NSToIntRound(aRect.origin.x * aBackingScale),
|
||||||
NSToIntRound(aRect.origin.y * aBackingScale),
|
NSToIntRound(aRect.origin.y * aBackingScale),
|
||||||
NSToIntRound(aRect.size.width * aBackingScale),
|
NSToIntRound(aRect.size.width * aBackingScale),
|
||||||
NSToIntRound(aRect.size.height * aBackingScale));
|
NSToIntRound(aRect.size.height * aBackingScale));
|
||||||
}
|
}
|
||||||
|
|
||||||
static CGFloat
|
static CGFloat
|
||||||
@ -184,20 +182,8 @@ public:
|
|||||||
(CGFloat)aPt.y / aBackingScale);
|
(CGFloat)aPt.y / aBackingScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: all calls to this function should eventually be replaced with calls
|
|
||||||
// to DevPixelsToCocoaPoints().
|
|
||||||
static NSRect
|
static NSRect
|
||||||
UntypedDevPixelsToCocoaPoints(const nsIntRect& aRect, CGFloat aBackingScale)
|
DevPixelsToCocoaPoints(const nsIntRect& aRect, CGFloat aBackingScale)
|
||||||
{
|
|
||||||
return NSMakeRect((CGFloat)aRect.x / aBackingScale,
|
|
||||||
(CGFloat)aRect.y / aBackingScale,
|
|
||||||
(CGFloat)aRect.width / aBackingScale,
|
|
||||||
(CGFloat)aRect.height / aBackingScale);
|
|
||||||
}
|
|
||||||
|
|
||||||
static NSRect
|
|
||||||
DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect,
|
|
||||||
CGFloat aBackingScale)
|
|
||||||
{
|
{
|
||||||
return NSMakeRect((CGFloat)aRect.x / aBackingScale,
|
return NSMakeRect((CGFloat)aRect.x / aBackingScale,
|
||||||
(CGFloat)aRect.y / aBackingScale,
|
(CGFloat)aRect.y / aBackingScale,
|
||||||
@ -231,8 +217,8 @@ public:
|
|||||||
// See explanation for geckoRectToCocoaRect, guess what this does...
|
// See explanation for geckoRectToCocoaRect, guess what this does...
|
||||||
static nsIntRect CocoaRectToGeckoRect(const NSRect &cocoaRect);
|
static nsIntRect CocoaRectToGeckoRect(const NSRect &cocoaRect);
|
||||||
|
|
||||||
static mozilla::LayoutDeviceIntRect CocoaRectToGeckoRectDevPix(
|
static nsIntRect CocoaRectToGeckoRectDevPix(const NSRect &aCocoaRect,
|
||||||
const NSRect& aCocoaRect, CGFloat aBackingScale);
|
CGFloat aBackingScale);
|
||||||
|
|
||||||
// Gives the location for the event in screen coordinates. Do not call this
|
// Gives the location for the event in screen coordinates. Do not call this
|
||||||
// unless the window the event was originally targeted at is still alive!
|
// unless the window the event was originally targeted at is still alive!
|
||||||
|
@ -97,10 +97,10 @@ nsIntRect nsCocoaUtils::CocoaRectToGeckoRect(const NSRect &cocoaRect)
|
|||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntRect nsCocoaUtils::CocoaRectToGeckoRectDevPix(
|
nsIntRect nsCocoaUtils::CocoaRectToGeckoRectDevPix(const NSRect &aCocoaRect,
|
||||||
const NSRect& aCocoaRect, CGFloat aBackingScale)
|
CGFloat aBackingScale)
|
||||||
{
|
{
|
||||||
LayoutDeviceIntRect rect;
|
nsIntRect rect;
|
||||||
rect.x = NSToIntRound(aCocoaRect.origin.x * aBackingScale);
|
rect.x = NSToIntRound(aCocoaRect.origin.x * aBackingScale);
|
||||||
rect.y = NSToIntRound(FlippedScreenY(aCocoaRect.origin.y + aCocoaRect.size.height) * aBackingScale);
|
rect.y = NSToIntRound(FlippedScreenY(aCocoaRect.origin.y + aCocoaRect.size.height) * aBackingScale);
|
||||||
rect.width = NSToIntRound((aCocoaRect.origin.x + aCocoaRect.size.width) * aBackingScale) - rect.x;
|
rect.width = NSToIntRound((aCocoaRect.origin.x + aCocoaRect.size.width) * aBackingScale) - rect.x;
|
||||||
|
@ -1573,7 +1573,8 @@ NS_IMETHODIMP nsCocoaWindow::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect
|
|||||||
|
|
||||||
CGFloat scaleFactor = BackingScaleFactor();
|
CGFloat scaleFactor = BackingScaleFactor();
|
||||||
if (!mWindow) {
|
if (!mWindow) {
|
||||||
aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor);
|
aRect = LayoutDeviceIntRect::FromUnknownRect(
|
||||||
|
nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1585,7 +1586,8 @@ NS_IMETHODIMP nsCocoaWindow::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect
|
|||||||
r = [mWindow contentRectForFrameRect:[mWindow frame]];
|
r = [mWindow contentRectForFrameRect:[mWindow frame]];
|
||||||
}
|
}
|
||||||
|
|
||||||
aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(r, scaleFactor);
|
aRect = LayoutDeviceIntRect::FromUnknownRect(
|
||||||
|
nsCocoaUtils::CocoaRectToGeckoRectDevPix(r, scaleFactor));
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
@ -1599,8 +1601,7 @@ nsCocoaWindow::UpdateBounds()
|
|||||||
if (mWindow) {
|
if (mWindow) {
|
||||||
frame = [mWindow frame];
|
frame = [mWindow frame];
|
||||||
}
|
}
|
||||||
mBounds = nsCocoaUtils::CocoaRectToGeckoRectDevPix(
|
mBounds = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
||||||
frame, BackingScaleFactor()).ToUnknownRect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
|
NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
|
||||||
@ -1608,8 +1609,8 @@ NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
|
|||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
LayoutDeviceIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix([mWindow frame], BackingScaleFactor());
|
nsIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix([mWindow frame], BackingScaleFactor());
|
||||||
NS_ASSERTION(mWindow && mBounds == r.ToUnknownRect(), "mBounds out of sync!");
|
NS_ASSERTION(mWindow && mBounds == r, "mBounds out of sync!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
||||||
@ -1985,13 +1986,13 @@ LayoutDeviceIntPoint nsCocoaWindow::WidgetToScreenOffset()
|
|||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||||
|
|
||||||
NSRect rect = NSZeroRect;
|
NSRect rect = NSZeroRect;
|
||||||
LayoutDeviceIntRect r;
|
nsIntRect r;
|
||||||
if (mWindow) {
|
if (mWindow) {
|
||||||
rect = [mWindow contentRectForFrameRect:[mWindow frame]];
|
rect = [mWindow contentRectForFrameRect:[mWindow frame]];
|
||||||
}
|
}
|
||||||
r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(rect, BackingScaleFactor());
|
r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(rect, BackingScaleFactor());
|
||||||
|
|
||||||
return r.TopLeft();
|
return LayoutDeviceIntPoint::FromUnknownPoint(r.TopLeft());
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
|
||||||
}
|
}
|
||||||
@ -2018,12 +2019,12 @@ nsCocoaWindow::ClientToWindowSize(const LayoutDeviceIntSize& aClientSize)
|
|||||||
return LayoutDeviceIntSize(0, 0);
|
return LayoutDeviceIntSize(0, 0);
|
||||||
|
|
||||||
CGFloat backingScale = BackingScaleFactor();
|
CGFloat backingScale = BackingScaleFactor();
|
||||||
LayoutDeviceIntRect r(0, 0, aClientSize.width, aClientSize.height);
|
nsIntRect r(0, 0, aClientSize.width, aClientSize.height);
|
||||||
NSRect rect = nsCocoaUtils::DevPixelsToCocoaPoints(r, backingScale);
|
NSRect rect = nsCocoaUtils::DevPixelsToCocoaPoints(r, backingScale);
|
||||||
|
|
||||||
NSRect inflatedRect = [mWindow frameRectForContentRect:rect];
|
NSRect inflatedRect = [mWindow frameRectForContentRect:rect];
|
||||||
r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(inflatedRect, backingScale);
|
r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(inflatedRect, backingScale);
|
||||||
return r.Size();
|
return LayoutDeviceIntSize(r.width, r.height);
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntSize(0,0));
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntSize(0,0));
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,7 @@ nsScreenCocoa::GetRect(int32_t *outX, int32_t *outY, int32_t *outWidth, int32_t
|
|||||||
{
|
{
|
||||||
NSRect frame = [mScreen frame];
|
NSRect frame = [mScreen frame];
|
||||||
|
|
||||||
LayoutDeviceIntRect r =
|
nsIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
||||||
nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
|
||||||
|
|
||||||
*outX = r.x;
|
*outX = r.x;
|
||||||
*outY = r.y;
|
*outY = r.y;
|
||||||
@ -60,8 +59,7 @@ nsScreenCocoa::GetAvailRect(int32_t *outX, int32_t *outY, int32_t *outWidth, int
|
|||||||
{
|
{
|
||||||
NSRect frame = [mScreen visibleFrame];
|
NSRect frame = [mScreen visibleFrame];
|
||||||
|
|
||||||
LayoutDeviceIntRect r =
|
nsIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
||||||
nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
|
||||||
|
|
||||||
*outX = r.x;
|
*outX = r.x;
|
||||||
*outY = r.y;
|
*outY = r.y;
|
||||||
|
@ -1479,7 +1479,7 @@ nsBaseWidget::SetWindowTitlebarColor(nscolor aColor, bool aActive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsBaseWidget::ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect)
|
nsBaseWidget::ShowsResizeIndicator(nsIntRect* aResizerRect)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ public:
|
|||||||
virtual bool PreRender(LayerManagerComposite* aManager) override { return true; }
|
virtual bool PreRender(LayerManagerComposite* aManager) override { return true; }
|
||||||
virtual void PostRender(LayerManagerComposite* aManager) override {}
|
virtual void PostRender(LayerManagerComposite* aManager) override {}
|
||||||
virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) override {}
|
virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) override {}
|
||||||
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, LayoutDeviceIntRect aRect) override {}
|
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) override {}
|
||||||
virtual already_AddRefed<mozilla::gfx::DrawTarget> StartRemoteDrawing() override;
|
virtual already_AddRefed<mozilla::gfx::DrawTarget> StartRemoteDrawing() override;
|
||||||
virtual void EndRemoteDrawing() override { };
|
virtual void EndRemoteDrawing() override { };
|
||||||
virtual void CleanupRemoteDrawing() override { };
|
virtual void CleanupRemoteDrawing() override { };
|
||||||
@ -202,7 +202,7 @@ public:
|
|||||||
NS_IMETHOD SetIcon(const nsAString &anIconSpec) override;
|
NS_IMETHOD SetIcon(const nsAString &anIconSpec) override;
|
||||||
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive) override;
|
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive) override;
|
||||||
virtual void SetDrawsInTitlebar(bool aState) override {}
|
virtual void SetDrawsInTitlebar(bool aState) override {}
|
||||||
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
|
virtual bool ShowsResizeIndicator(nsIntRect* aResizerRect) override;
|
||||||
virtual void FreeNativeData(void * data, uint32_t aDataType) override {}
|
virtual void FreeNativeData(void * data, uint32_t aDataType) override {}
|
||||||
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||||
int32_t aHorizontal,
|
int32_t aHorizontal,
|
||||||
|
@ -335,7 +335,6 @@ class nsIWidget : public nsISupports {
|
|||||||
typedef mozilla::LayoutDeviceIntMargin LayoutDeviceIntMargin;
|
typedef mozilla::LayoutDeviceIntMargin LayoutDeviceIntMargin;
|
||||||
typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
|
typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
|
||||||
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
|
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
|
||||||
typedef mozilla::LayoutDeviceIntRegion LayoutDeviceIntRegion;
|
|
||||||
typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize;
|
typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize;
|
||||||
|
|
||||||
// Used in UpdateThemeGeometries.
|
// Used in UpdateThemeGeometries.
|
||||||
@ -1259,8 +1258,7 @@ class nsIWidget : public nsISupports {
|
|||||||
*
|
*
|
||||||
* Always called from the compositing thread.
|
* Always called from the compositing thread.
|
||||||
*/
|
*/
|
||||||
virtual void DrawWindowOverlay(LayerManagerComposite* aManager,
|
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0;
|
||||||
LayoutDeviceIntRect aRect) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a DrawTarget for the window which can be composited into.
|
* Return a DrawTarget for the window which can be composited into.
|
||||||
@ -1502,7 +1500,7 @@ class nsIWidget : public nsISupports {
|
|||||||
* @param aResizerRect The resizer's rect in device pixels.
|
* @param aResizerRect The resizer's rect in device pixels.
|
||||||
* @return Whether a resize widget is shown.
|
* @return Whether a resize widget is shown.
|
||||||
*/
|
*/
|
||||||
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) = 0;
|
virtual bool ShowsResizeIndicator(nsIntRect* aResizerRect) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the popup that was last rolled up, or null if there isn't one.
|
* Return the popup that was last rolled up, or null if there isn't one.
|
||||||
|
Loading…
Reference in New Issue
Block a user