Bug 1225007 (part 1, attempt 2) - Use LayoutDevicePixel more in Cocoa widget code. r=kats.
This commit is contained in:
@@ -810,10 +810,9 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allow widget to render a custom foreground.
|
// Allow widget to render a custom foreground.
|
||||||
mCompositor->GetWidget()->DrawWindowOverlay(this, IntRect(actualBounds.x,
|
mCompositor->GetWidget()->DrawWindowOverlay(
|
||||||
actualBounds.y,
|
this, LayoutDeviceIntRect(actualBounds.x, actualBounds.y,
|
||||||
actualBounds.width,
|
actualBounds.width, actualBounds.height));
|
||||||
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);
|
||||||
nsIntRect widgetRect;
|
LayoutDeviceIntRect widgetRect;
|
||||||
if (!widget || !widget->ShowsResizeIndicator(&widgetRect))
|
if (!widget || !widget->ShowsResizeIndicator(&widgetRect))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -2636,7 +2636,8 @@ nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager,
|
||||||
|
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, nsIntRect aRect) override;
|
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, LayoutDeviceIntRect aRect) override;
|
||||||
|
|
||||||
virtual mozilla::layers::CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) override;
|
virtual mozilla::layers::CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) override;
|
||||||
|
|
||||||
|
|||||||
@@ -3316,8 +3316,7 @@ IMEInputHandler::FirstRectForCharacterRange(NSRange& aRange,
|
|||||||
if (!rootWindow || !rootView) {
|
if (!rootWindow || !rootView) {
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
rect = nsCocoaUtils::DevPixelsToCocoaPoints(r.ToUnknownRect(),
|
rect = nsCocoaUtils::DevPixelsToCocoaPoints(r, mWidget->BackingScaleFactor());
|
||||||
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.DevPixelsToCocoaPoints(*iterRect);
|
NSRect rect = mCoordinateConverter.UntypedDevPixelsToCocoaPoints(*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.DevPixelsToCocoaPoints(*rect));
|
NSRectFill(mCoordinateConverter.UntypedDevPixelsToCocoaPoints(*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(nsIntRect* aResizerRect) override;
|
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
|
||||||
|
|
||||||
static bool ConvertStatus(nsEventStatus aStatus)
|
static bool ConvertStatus(nsEventStatus aStatus)
|
||||||
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
||||||
@@ -487,12 +487,13 @@ 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, nsIntRect aRect) override;
|
virtual void DrawWindowOverlay(LayerManagerComposite* aManager,
|
||||||
|
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 nsIntRegion& GetDraggableRegion() { return mDraggableRegion; }
|
const LayoutDeviceIntRegion& GetDraggableRegion() { return mDraggableRegion; }
|
||||||
|
|
||||||
virtual void ReportSwipeStarted(uint64_t aInputBlockId, bool aStartSwipe) override;
|
virtual void ReportSwipeStarted(uint64_t aInputBlockId, bool aStartSwipe) override;
|
||||||
|
|
||||||
@@ -524,13 +525,18 @@ public:
|
|||||||
nsIntPoint CocoaPointsToDevPixels(const NSPoint& aPt) const {
|
nsIntPoint CocoaPointsToDevPixels(const NSPoint& aPt) const {
|
||||||
return nsCocoaUtils::CocoaPointsToDevPixels(aPt, BackingScaleFactor());
|
return nsCocoaUtils::CocoaPointsToDevPixels(aPt, BackingScaleFactor());
|
||||||
}
|
}
|
||||||
nsIntRect CocoaPointsToDevPixels(const NSRect& aRect) const {
|
LayoutDeviceIntRect 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());
|
||||||
}
|
}
|
||||||
NSRect DevPixelsToCocoaPoints(const nsIntRect& aRect) const {
|
// XXX: all calls to this function should eventually be replaced with calls
|
||||||
|
// 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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,19 +583,19 @@ protected:
|
|||||||
void ConfigureAPZCTreeManager() override;
|
void ConfigureAPZCTreeManager() override;
|
||||||
void ConfigureAPZControllerThread() override;
|
void ConfigureAPZControllerThread() override;
|
||||||
|
|
||||||
void DoRemoteComposition(const nsIntRect& aRenderRect);
|
void DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect);
|
||||||
|
|
||||||
// Overlay drawing functions for OpenGL drawing
|
// Overlay drawing functions for OpenGL drawing
|
||||||
void DrawWindowOverlay(mozilla::layers::GLManager* aManager, nsIntRect aRect);
|
void DrawWindowOverlay(mozilla::layers::GLManager* aManager, LayoutDeviceIntRect aRect);
|
||||||
void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
|
void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager);
|
||||||
void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
|
void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager, const LayoutDeviceIntRect& aRect);
|
||||||
void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
|
void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager);
|
||||||
|
|
||||||
// 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();
|
||||||
|
|
||||||
nsIntRect RectContainingTitlebarControls();
|
LayoutDeviceIntRect RectContainingTitlebarControls();
|
||||||
void UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries);
|
void UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries);
|
||||||
mozilla::VibrancyManager& EnsureVibrancyManager();
|
mozilla::VibrancyManager& EnsureVibrancyManager();
|
||||||
|
|
||||||
@@ -631,16 +637,16 @@ protected:
|
|||||||
// May be accessed from any thread, protected
|
// May be accessed from any thread, protected
|
||||||
// by mEffectsLock.
|
// by mEffectsLock.
|
||||||
bool mShowsResizeIndicator;
|
bool mShowsResizeIndicator;
|
||||||
nsIntRect mResizeIndicatorRect;
|
LayoutDeviceIntRect mResizeIndicatorRect;
|
||||||
bool mHasRoundedBottomCorners;
|
bool mHasRoundedBottomCorners;
|
||||||
int mDevPixelCornerRadius;
|
int mDevPixelCornerRadius;
|
||||||
bool mIsCoveringTitlebar;
|
bool mIsCoveringTitlebar;
|
||||||
bool mIsFullscreen;
|
bool mIsFullscreen;
|
||||||
nsIntRect mTitlebarRect;
|
LayoutDeviceIntRect 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.
|
||||||
nsIntRegion mUpdatedTitlebarRegion;
|
LayoutDeviceIntRegion mUpdatedTitlebarRegion;
|
||||||
CGContextRef mTitlebarCGContext;
|
CGContextRef mTitlebarCGContext;
|
||||||
|
|
||||||
// Compositor thread only
|
// Compositor thread only
|
||||||
@@ -653,7 +659,7 @@ protected:
|
|||||||
// uploaded to to mTitlebarImage. Main thread only.
|
// uploaded to to mTitlebarImage. Main thread only.
|
||||||
nsIntRegion mDirtyTitlebarRegion;
|
nsIntRegion mDirtyTitlebarRegion;
|
||||||
|
|
||||||
nsIntRegion mDraggableRegion;
|
LayoutDeviceIntRegion 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
|
||||||
|
|||||||
@@ -162,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;
|
||||||
- (nsIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
|
- (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
|
||||||
- (BOOL)isUsingMainThreadOpenGL;
|
- (BOOL)isUsingMainThreadOpenGL;
|
||||||
- (BOOL)isUsingOpenGL;
|
- (BOOL)isUsingOpenGL;
|
||||||
- (void)drawUsingOpenGL;
|
- (void)drawUsingOpenGL;
|
||||||
@@ -279,13 +279,15 @@ public:
|
|||||||
virtual ~RectTextureImage();
|
virtual ~RectTextureImage();
|
||||||
|
|
||||||
already_AddRefed<gfx::DrawTarget>
|
already_AddRefed<gfx::DrawTarget>
|
||||||
BeginUpdate(const nsIntSize& aNewSize,
|
BeginUpdate(const LayoutDeviceIntSize& aNewSize,
|
||||||
const nsIntRegion& aDirtyRegion = nsIntRegion());
|
const LayoutDeviceIntRegion& aDirtyRegion =
|
||||||
|
LayoutDeviceIntRegion());
|
||||||
void EndUpdate(bool aKeepSurface = false);
|
void EndUpdate(bool aKeepSurface = false);
|
||||||
|
|
||||||
void UpdateIfNeeded(const nsIntSize& aNewSize,
|
void UpdateIfNeeded(const LayoutDeviceIntSize& aNewSize,
|
||||||
const nsIntRegion& aDirtyRegion,
|
const LayoutDeviceIntRegion& aDirtyRegion,
|
||||||
void (^aCallback)(gfx::DrawTarget*, const nsIntRegion&))
|
void (^aCallback)(gfx::DrawTarget*,
|
||||||
|
const LayoutDeviceIntRegion&))
|
||||||
{
|
{
|
||||||
RefPtr<gfx::DrawTarget> drawTarget = BeginUpdate(aNewSize, aDirtyRegion);
|
RefPtr<gfx::DrawTarget> drawTarget = BeginUpdate(aNewSize, aDirtyRegion);
|
||||||
if (drawTarget) {
|
if (drawTarget) {
|
||||||
@@ -294,29 +296,30 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateFromCGContext(const nsIntSize& aNewSize,
|
void UpdateFromCGContext(const LayoutDeviceIntSize& aNewSize,
|
||||||
const nsIntRegion& aDirtyRegion,
|
const LayoutDeviceIntRegion& aDirtyRegion,
|
||||||
CGContextRef aCGContext);
|
CGContextRef aCGContext);
|
||||||
|
|
||||||
nsIntRegion GetUpdateRegion() {
|
LayoutDeviceIntRegion 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 nsIntPoint& aLocation,
|
const LayoutDeviceIntPoint& aLocation,
|
||||||
const Matrix4x4& aTransform = Matrix4x4());
|
const Matrix4x4& aTransform = Matrix4x4());
|
||||||
|
|
||||||
static nsIntSize TextureSizeForSize(const nsIntSize& aSize);
|
static LayoutDeviceIntSize TextureSizeForSize(
|
||||||
|
const LayoutDeviceIntSize& aSize);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
RefPtr<gfx::DrawTarget> mUpdateDrawTarget;
|
RefPtr<gfx::DrawTarget> mUpdateDrawTarget;
|
||||||
GLContext* mGLContext;
|
GLContext* mGLContext;
|
||||||
nsIntRegion mUpdateRegion;
|
LayoutDeviceIntRegion mUpdateRegion;
|
||||||
nsIntSize mUsedSize;
|
LayoutDeviceIntSize mUsedSize;
|
||||||
nsIntSize mBufferSize;
|
LayoutDeviceIntSize mBufferSize;
|
||||||
nsIntSize mTextureSize;
|
LayoutDeviceIntSize mTextureSize;
|
||||||
GLuint mTexture;
|
GLuint mTexture;
|
||||||
bool mInUpdate;
|
bool mInUpdate;
|
||||||
};
|
};
|
||||||
@@ -356,7 +359,7 @@ public:
|
|||||||
const gfx::Rect& aLayerRect,
|
const gfx::Rect& aLayerRect,
|
||||||
const gfx::Rect& aTextureRect) override;
|
const gfx::Rect& aTextureRect) override;
|
||||||
|
|
||||||
void BeginFrame(nsIntSize aRenderSize);
|
void BeginFrame(LayoutDeviceIntSize aRenderSize);
|
||||||
void EndFrame();
|
void EndFrame();
|
||||||
|
|
||||||
NSOpenGLContext* GetNSOpenGLContext()
|
NSOpenGLContext* GetNSOpenGLContext()
|
||||||
@@ -513,7 +516,8 @@ 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(mBounds, scaleFactor);
|
NSRect r = nsCocoaUtils::DevPixelsToCocoaPoints(
|
||||||
|
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;
|
||||||
@@ -908,13 +912,9 @@ 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)
|
||||||
{
|
{
|
||||||
nsIntRect tmp;
|
aRect = !mView
|
||||||
if (!mView) {
|
? LayoutDeviceIntRect::FromUnknownRect(mBounds)
|
||||||
tmp = mBounds;
|
: CocoaPointsToDevPixels([mView frame]);
|
||||||
} else {
|
|
||||||
tmp = CocoaPointsToDevPixels([mView frame]);
|
|
||||||
}
|
|
||||||
aRect = LayoutDeviceIntRect::FromUnknownRect(tmp);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,7 +1006,7 @@ NS_IMETHODIMP nsChildView::Move(double aX, double aY)
|
|||||||
mBounds.y = y;
|
mBounds.y = y;
|
||||||
|
|
||||||
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
||||||
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
[mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
|
||||||
});
|
});
|
||||||
|
|
||||||
NotifyRollupGeometryChange();
|
NotifyRollupGeometryChange();
|
||||||
@@ -1031,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:DevPixelsToCocoaPoints(mBounds)];
|
[mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mVisible && aRepaint)
|
if (mVisible && aRepaint)
|
||||||
@@ -1070,7 +1070,7 @@ NS_IMETHODIMP nsChildView::Resize(double aX, double aY,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
||||||
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
[mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mVisible && aRepaint)
|
if (mVisible && aRepaint)
|
||||||
@@ -1092,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(nsIntRect* aResizerRect)
|
bool nsChildView::ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect)
|
||||||
{
|
{
|
||||||
NSView *topLevelView = mView, *superView = nil;
|
NSView *topLevelView = mView, *superView = nil;
|
||||||
while ((superView = [topLevelView superview]))
|
while ((superView = [topLevelView superview]))
|
||||||
@@ -1364,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:DevPixelsToCocoaPoints(aRect)];
|
[mView setNeedsPendingDisplayInRect:UntypedDevPixelsToCocoaPoints(aRect)];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[mView setNeedsDisplayInRect:DevPixelsToCocoaPoints(aRect)];
|
[mView setNeedsDisplayInRect:UntypedDevPixelsToCocoaPoints(aRect)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@@ -1941,7 +1941,7 @@ nsChildView::ConfigureAPZControllerThread()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect
|
LayoutDeviceIntRect
|
||||||
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.
|
||||||
@@ -2015,7 +2015,8 @@ nsChildView::PostRender(LayerManagerComposite* aManager)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager,
|
||||||
|
LayoutDeviceIntRect aRect)
|
||||||
{
|
{
|
||||||
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
|
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
|
||||||
if (manager) {
|
if (manager) {
|
||||||
@@ -2024,20 +2025,20 @@ nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::DrawWindowOverlay(GLManager* aManager, nsIntRect aRect)
|
nsChildView::DrawWindowOverlay(GLManager* aManager, LayoutDeviceIntRect 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, aRect);
|
MaybeDrawTitlebar(aManager);
|
||||||
MaybeDrawResizeIndicator(aManager, aRect);
|
MaybeDrawResizeIndicator(aManager);
|
||||||
MaybeDrawRoundedCorners(aManager, aRect);
|
MaybeDrawRoundedCorners(aManager, aRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ClearRegion(gfx::DrawTarget *aDT, nsIntRegion aRegion)
|
ClearRegion(gfx::DrawTarget *aDT, LayoutDeviceIntRegion aRegion)
|
||||||
{
|
{
|
||||||
gfxUtils::ClipToRegion(aDT, aRegion);
|
gfxUtils::ClipToRegion(aDT, aRegion.ToUnknownRegion());
|
||||||
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();
|
||||||
}
|
}
|
||||||
@@ -2076,7 +2077,7 @@ DrawResizer(CGContextRef aCtx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::MaybeDrawResizeIndicator(GLManager* aManager, const nsIntRect& aRect)
|
nsChildView::MaybeDrawResizeIndicator(GLManager* aManager)
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mEffectsLock);
|
MutexAutoLock lock(mEffectsLock);
|
||||||
if (!mShowsResizeIndicator) {
|
if (!mShowsResizeIndicator) {
|
||||||
@@ -2087,8 +2088,8 @@ nsChildView::MaybeDrawResizeIndicator(GLManager* aManager, const nsIntRect& aRec
|
|||||||
mResizerImage = new RectTextureImage(aManager->gl());
|
mResizerImage = new RectTextureImage(aManager->gl());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntSize size = mResizeIndicatorRect.Size();
|
LayoutDeviceIntSize size = mResizeIndicatorRect.Size();
|
||||||
mResizerImage->UpdateIfNeeded(size, nsIntRegion(), ^(gfx::DrawTarget* drawTarget, const nsIntRegion& updateRegion) {
|
mResizerImage->UpdateIfNeeded(size, LayoutDeviceIntRegion(), ^(gfx::DrawTarget* drawTarget, const LayoutDeviceIntRegion& updateRegion) {
|
||||||
ClearRegion(drawTarget, updateRegion);
|
ClearRegion(drawTarget, updateRegion);
|
||||||
gfx::BorrowedCGContext borrow(drawTarget);
|
gfx::BorrowedCGContext borrow(drawTarget);
|
||||||
DrawResizer(borrow.cg);
|
DrawResizer(borrow.cg);
|
||||||
@@ -2131,7 +2132,7 @@ DrawTitlebarHighlight(NSSize aWindowSize, CGFloat aRadius, CGFloat aDevicePixelW
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CGContextRef
|
static CGContextRef
|
||||||
CreateCGContext(const nsIntSize& aSize)
|
CreateCGContext(const LayoutDeviceIntSize& aSize)
|
||||||
{
|
{
|
||||||
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
|
||||||
CGContextRef ctx =
|
CGContextRef ctx =
|
||||||
@@ -2164,7 +2165,8 @@ 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);
|
||||||
|
|
||||||
nsIntSize texSize = RectTextureImage::TextureSizeForSize(mTitlebarRect.Size());
|
LayoutDeviceIntSize texSize =
|
||||||
|
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)) {
|
||||||
@@ -2285,14 +2287,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, const nsIntRect& aRect)
|
nsChildView::MaybeDrawTitlebar(GLManager* aManager)
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mEffectsLock);
|
MutexAutoLock lock(mEffectsLock);
|
||||||
if (!mIsCoveringTitlebar || mIsFullscreen) {
|
if (!mIsCoveringTitlebar || mIsFullscreen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRegion updatedTitlebarRegion;
|
LayoutDeviceIntRegion updatedTitlebarRegion;
|
||||||
updatedTitlebarRegion.And(mUpdatedTitlebarRegion, mTitlebarRect);
|
updatedTitlebarRegion.And(mUpdatedTitlebarRegion, mTitlebarRect);
|
||||||
mUpdatedTitlebarRegion.SetEmpty();
|
mUpdatedTitlebarRegion.SetEmpty();
|
||||||
|
|
||||||
@@ -2315,7 +2317,8 @@ DrawTopLeftCornerMask(CGContextRef aCtx, int aRadius)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::MaybeDrawRoundedCorners(GLManager* aManager, const nsIntRect& aRect)
|
nsChildView::MaybeDrawRoundedCorners(GLManager* aManager,
|
||||||
|
const LayoutDeviceIntRect& aRect)
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mEffectsLock);
|
MutexAutoLock lock(mEffectsLock);
|
||||||
|
|
||||||
@@ -2323,8 +2326,8 @@ nsChildView::MaybeDrawRoundedCorners(GLManager* aManager, const nsIntRect& aRect
|
|||||||
mCornerMaskImage = new RectTextureImage(aManager->gl());
|
mCornerMaskImage = new RectTextureImage(aManager->gl());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntSize size(mDevPixelCornerRadius, mDevPixelCornerRadius);
|
LayoutDeviceIntSize size(mDevPixelCornerRadius, mDevPixelCornerRadius);
|
||||||
mCornerMaskImage->UpdateIfNeeded(size, nsIntRegion(), ^(gfx::DrawTarget* drawTarget, const nsIntRegion& updateRegion) {
|
mCornerMaskImage->UpdateIfNeeded(size, LayoutDeviceIntRegion(), ^(gfx::DrawTarget* drawTarget, const LayoutDeviceIntRegion& 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);
|
||||||
@@ -2392,17 +2395,17 @@ FindUnifiedToolbarBottom(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometr
|
|||||||
return unifiedToolbarBottom;
|
return unifiedToolbarBottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsIntRect
|
static LayoutDeviceIntRect
|
||||||
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 g.mRect;
|
return LayoutDeviceIntRect::FromUnknownRect(g.mRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nsIntRect();
|
return LayoutDeviceIntRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -2434,9 +2437,9 @@ nsChildView::UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometri
|
|||||||
[win setSheetAttachmentPosition:DevPixelsToCocoaPoints(devSheetPosition)];
|
[win setSheetAttachmentPosition:DevPixelsToCocoaPoints(devSheetPosition)];
|
||||||
|
|
||||||
// Update titlebar control offsets.
|
// Update titlebar control offsets.
|
||||||
nsIntRect windowButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeWindowButtons);
|
LayoutDeviceIntRect windowButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeWindowButtons);
|
||||||
[win placeWindowButtons:[mView convertRect:DevPixelsToCocoaPoints(windowButtonRect) toView:nil]];
|
[win placeWindowButtons:[mView convertRect:DevPixelsToCocoaPoints(windowButtonRect) toView:nil]];
|
||||||
nsIntRect fullScreenButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeFullscreenButton);
|
LayoutDeviceIntRect fullScreenButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeFullscreenButton);
|
||||||
[win placeFullScreenButton:[mView convertRect:DevPixelsToCocoaPoints(fullScreenButtonRect) toView:nil]];
|
[win placeFullScreenButton:[mView convertRect:DevPixelsToCocoaPoints(fullScreenButtonRect) toView:nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2632,8 +2635,9 @@ nsChildView::StartRemoteDrawing()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRegion dirtyRegion = mBounds;
|
LayoutDeviceIntRegion dirtyRegion(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
||||||
nsIntSize renderSize = mBounds.Size();
|
LayoutDeviceIntSize renderSize =
|
||||||
|
LayoutDeviceIntSize::FromUnknownSize(mBounds.Size());
|
||||||
|
|
||||||
if (!mBasicCompositorImage) {
|
if (!mBasicCompositorImage) {
|
||||||
mBasicCompositorImage = new RectTextureImage(mGLPresenter->gl());
|
mBasicCompositorImage = new RectTextureImage(mGLPresenter->gl());
|
||||||
@@ -2644,7 +2648,7 @@ nsChildView::StartRemoteDrawing()
|
|||||||
|
|
||||||
if (!drawTarget) {
|
if (!drawTarget) {
|
||||||
// Composite unchanged textures.
|
// Composite unchanged textures.
|
||||||
DoRemoteComposition(mBounds);
|
DoRemoteComposition(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2655,7 +2659,7 @@ void
|
|||||||
nsChildView::EndRemoteDrawing()
|
nsChildView::EndRemoteDrawing()
|
||||||
{
|
{
|
||||||
mBasicCompositorImage->EndUpdate(true);
|
mBasicCompositorImage->EndUpdate(true);
|
||||||
DoRemoteComposition(mBounds);
|
DoRemoteComposition(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -2682,7 +2686,7 @@ nsChildView::InitCompositor(Compositor* aCompositor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::DoRemoteComposition(const nsIntRect& aRenderRect)
|
nsChildView::DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect)
|
||||||
{
|
{
|
||||||
if (![(ChildView*)mView preRender:mGLPresenter->GetNSOpenGLContext()]) {
|
if (![(ChildView*)mView preRender:mGLPresenter->GetNSOpenGLContext()]) {
|
||||||
return;
|
return;
|
||||||
@@ -2690,7 +2694,7 @@ nsChildView::DoRemoteComposition(const nsIntRect& 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, nsIntPoint(0, 0));
|
mBasicCompositorImage->Draw(mGLPresenter, LayoutDeviceIntPoint(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.
|
||||||
@@ -2704,8 +2708,10 @@ nsChildView::DoRemoteComposition(const nsIntRect& aRenderRect)
|
|||||||
void
|
void
|
||||||
nsChildView::UpdateWindowDraggingRegion(const nsIntRegion& aRegion)
|
nsChildView::UpdateWindowDraggingRegion(const nsIntRegion& aRegion)
|
||||||
{
|
{
|
||||||
if (mDraggableRegion != aRegion) {
|
LayoutDeviceIntRegion region =
|
||||||
mDraggableRegion = aRegion;
|
LayoutDeviceIntRegion::FromUnknownRegion(aRegion);
|
||||||
|
if (mDraggableRegion != region) {
|
||||||
|
mDraggableRegion = region;
|
||||||
[(ChildView*)mView updateWindowDraggableState];
|
[(ChildView*)mView updateWindowDraggableState];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2875,29 +2881,30 @@ RectTextureImage::~RectTextureImage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntSize
|
LayoutDeviceIntSize
|
||||||
RectTextureImage::TextureSizeForSize(const nsIntSize& aSize)
|
RectTextureImage::TextureSizeForSize(const LayoutDeviceIntSize& aSize)
|
||||||
{
|
{
|
||||||
return nsIntSize(gfx::NextPowerOfTwo(aSize.width),
|
return LayoutDeviceIntSize(gfx::NextPowerOfTwo(aSize.width),
|
||||||
gfx::NextPowerOfTwo(aSize.height));
|
gfx::NextPowerOfTwo(aSize.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<gfx::DrawTarget>
|
already_AddRefed<gfx::DrawTarget>
|
||||||
RectTextureImage::BeginUpdate(const nsIntSize& aNewSize,
|
RectTextureImage::BeginUpdate(const LayoutDeviceIntSize& aNewSize,
|
||||||
const nsIntRegion& aDirtyRegion)
|
const LayoutDeviceIntRegion& 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 = gfx::IntRect(gfx::IntPoint(0, 0), aNewSize);
|
mUpdateRegion =
|
||||||
|
LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0), aNewSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mUpdateRegion.IsEmpty()) {
|
if (mUpdateRegion.IsEmpty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntSize neededBufferSize = TextureSizeForSize(mUsedSize);
|
LayoutDeviceIntSize 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 =
|
||||||
@@ -2926,14 +2933,15 @@ 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;
|
||||||
nsIntRegion updateRegion = mUpdateRegion;
|
LayoutDeviceIntRegion 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 = gfx::IntRect(gfx::IntPoint(0, 0), mTextureSize);
|
updateRegion =
|
||||||
|
LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0), mTextureSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<gfx::SourceSurface> snapshot = mUpdateDrawTarget->Snapshot();
|
RefPtr<gfx::SourceSurface> snapshot = mUpdateDrawTarget->Snapshot();
|
||||||
@@ -2941,10 +2949,10 @@ RectTextureImage::EndUpdate(bool aKeepSurface)
|
|||||||
|
|
||||||
UploadSurfaceToTexture(mGLContext,
|
UploadSurfaceToTexture(mGLContext,
|
||||||
dataSnapshot,
|
dataSnapshot,
|
||||||
updateRegion,
|
updateRegion.ToUnknownRegion(),
|
||||||
mTexture,
|
mTexture,
|
||||||
overwriteTexture,
|
overwriteTexture,
|
||||||
updateRegion.GetBounds().TopLeft(),
|
updateRegion.GetBounds().TopLeft().ToUnknownPoint(),
|
||||||
false,
|
false,
|
||||||
LOCAL_GL_TEXTURE0,
|
LOCAL_GL_TEXTURE0,
|
||||||
LOCAL_GL_TEXTURE_RECTANGLE_ARB);
|
LOCAL_GL_TEXTURE_RECTANGLE_ARB);
|
||||||
@@ -2957,8 +2965,8 @@ RectTextureImage::EndUpdate(bool aKeepSurface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RectTextureImage::UpdateFromCGContext(const nsIntSize& aNewSize,
|
RectTextureImage::UpdateFromCGContext(const LayoutDeviceIntSize& aNewSize,
|
||||||
const nsIntRegion& aDirtyRegion,
|
const LayoutDeviceIntRegion& aDirtyRegion,
|
||||||
CGContextRef aCGContext)
|
CGContextRef aCGContext)
|
||||||
{
|
{
|
||||||
gfx::IntSize size = gfx::IntSize(CGBitmapContextGetWidth(aCGContext),
|
gfx::IntSize size = gfx::IntSize(CGBitmapContextGetWidth(aCGContext),
|
||||||
@@ -2967,7 +2975,7 @@ RectTextureImage::UpdateFromCGContext(const nsIntSize& 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());
|
gfxUtils::ClipToRegion(dt, GetUpdateRegion().ToUnknownRegion());
|
||||||
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,
|
||||||
@@ -2983,7 +2991,7 @@ RectTextureImage::UpdateFromCGContext(const nsIntSize& aNewSize,
|
|||||||
|
|
||||||
void
|
void
|
||||||
RectTextureImage::Draw(GLManager* aManager,
|
RectTextureImage::Draw(GLManager* aManager,
|
||||||
const nsIntPoint& aLocation,
|
const LayoutDeviceIntPoint& 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,
|
||||||
@@ -3076,7 +3084,7 @@ GLPresenter::BindAndDrawQuad(ShaderProgramOGL *aProgram,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GLPresenter::BeginFrame(nsIntSize aRenderSize)
|
GLPresenter::BeginFrame(LayoutDeviceIntSize aRenderSize)
|
||||||
{
|
{
|
||||||
mGLContext->MakeCurrent();
|
mGLContext->MakeCurrent();
|
||||||
|
|
||||||
@@ -3610,9 +3618,9 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
return mGeckoChild->VibrancyFontSmoothingBackgroundColorForThemeGeometryType(aThemeGeometryType);
|
return mGeckoChild->VibrancyFontSmoothingBackgroundColorForThemeGeometryType(aThemeGeometryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nsIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect
|
- (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect
|
||||||
{
|
{
|
||||||
nsIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
|
LayoutDeviceIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
|
||||||
const NSRect *rects;
|
const NSRect *rects;
|
||||||
NSInteger count;
|
NSInteger count;
|
||||||
[self getRectsBeingDrawn:&rects count:&count];
|
[self getRectsBeingDrawn:&rects count:&count];
|
||||||
@@ -3621,7 +3629,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
return boundingRect;
|
return boundingRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRegion region;
|
LayoutDeviceIntRegion 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]));
|
||||||
}
|
}
|
||||||
@@ -3698,7 +3706,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
|
|
||||||
CGContextSaveGState(aContext);
|
CGContextSaveGState(aContext);
|
||||||
|
|
||||||
nsIntRegion region = [self nativeDirtyRegionWithBoundingRect:aRect];
|
LayoutDeviceIntRegion region = [self nativeDirtyRegionWithBoundingRect:aRect];
|
||||||
|
|
||||||
// Create Cairo objects.
|
// Create Cairo objects.
|
||||||
RefPtr<gfxQuartzSurface> targetSurface;
|
RefPtr<gfxQuartzSurface> targetSurface;
|
||||||
@@ -3712,7 +3720,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);
|
nsIntRegionRectIterator iter(region.ToUnknownRegion());
|
||||||
targetContext->NewPath();
|
targetContext->NewPath();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const nsIntRect* r = iter.Next();
|
const nsIntRect* r = iter.Next();
|
||||||
@@ -3727,10 +3735,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);
|
painted = mGeckoChild->PaintWindow(region.ToUnknownRegion());
|
||||||
} 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);
|
painted = mGeckoChild->PaintWindow(region.ToUnknownRegion());
|
||||||
}
|
}
|
||||||
|
|
||||||
targetContext = nullptr;
|
targetContext = nullptr;
|
||||||
@@ -4589,7 +4597,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||||||
|
|
||||||
static CGSRegionObj
|
static CGSRegionObj
|
||||||
NewCGSRegionFromRegion(const nsIntRegion& aRegion,
|
NewCGSRegionFromRegion(const nsIntRegion& aRegion,
|
||||||
CGRect (^aRectConverter)(const nsIntRect&))
|
CGRect (^aRectConverter)(const LayoutDeviceIntRect&))
|
||||||
{
|
{
|
||||||
nsTArray<CGRect> rects;
|
nsTArray<CGRect> rects;
|
||||||
nsIntRegionRectIterator iter(aRegion);
|
nsIntRegionRectIterator iter(aRegion);
|
||||||
@@ -4597,7 +4605,7 @@ NewCGSRegionFromRegion(const nsIntRegion& aRegion,
|
|||||||
const nsIntRect* r = iter.Next();
|
const nsIntRect* r = iter.Next();
|
||||||
if (!r)
|
if (!r)
|
||||||
break;
|
break;
|
||||||
rects.AppendElement(aRectConverter(*r));
|
rects.AppendElement(aRectConverter(LayoutDeviceIntRect::FromUnknownRect(*r)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CGSRegionObj region;
|
CGSRegionObj region;
|
||||||
@@ -4615,12 +4623,12 @@ NewCGSRegionFromRegion(const nsIntRegion& aRegion,
|
|||||||
return [super _regionForOpaqueDescendants:aRect forMove:aForMove];
|
return [super _regionForOpaqueDescendants:aRect forMove:aForMove];
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
|
LayoutDeviceIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
|
||||||
|
|
||||||
nsIntRegion opaqueRegion;
|
LayoutDeviceIntRegion opaqueRegion;
|
||||||
opaqueRegion.Sub(boundingRect, mGeckoChild->GetDraggableRegion());
|
opaqueRegion.Sub(boundingRect, mGeckoChild->GetDraggableRegion());
|
||||||
|
|
||||||
return NewCGSRegionFromRegion(opaqueRegion, ^(const nsIntRect& r) {
|
return NewCGSRegionFromRegion(opaqueRegion.ToUnknownRegion(), ^(const LayoutDeviceIntRect& r) {
|
||||||
return [self convertToFlippedWindowCoordinates:mGeckoChild->DevPixelsToCocoaPoints(r)];
|
return [self convertToFlippedWindowCoordinates:mGeckoChild->DevPixelsToCocoaPoints(r)];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ struct KeyBindingsCommand
|
|||||||
class nsCocoaUtils
|
class nsCocoaUtils
|
||||||
{
|
{
|
||||||
typedef mozilla::gfx::SourceSurface SourceSurface;
|
typedef mozilla::gfx::SourceSurface SourceSurface;
|
||||||
|
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -159,10 +160,10 @@ public:
|
|||||||
NSToIntRound(aPt.y * aBackingScale));
|
NSToIntRound(aPt.y * aBackingScale));
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsIntRect
|
static LayoutDeviceIntRect
|
||||||
CocoaPointsToDevPixels(const NSRect& aRect, CGFloat aBackingScale)
|
CocoaPointsToDevPixels(const NSRect& aRect, CGFloat aBackingScale)
|
||||||
{
|
{
|
||||||
return nsIntRect(NSToIntRound(aRect.origin.x * aBackingScale),
|
return LayoutDeviceIntRect(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));
|
||||||
@@ -182,8 +183,20 @@ 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
|
||||||
DevPixelsToCocoaPoints(const nsIntRect& aRect, CGFloat aBackingScale)
|
UntypedDevPixelsToCocoaPoints(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,
|
||||||
@@ -217,8 +230,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 nsIntRect CocoaRectToGeckoRectDevPix(const NSRect &aCocoaRect,
|
static mozilla::LayoutDeviceIntRect CocoaRectToGeckoRectDevPix(
|
||||||
CGFloat aBackingScale);
|
const NSRect& aCocoaRect, 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect nsCocoaUtils::CocoaRectToGeckoRectDevPix(const NSRect &aCocoaRect,
|
LayoutDeviceIntRect nsCocoaUtils::CocoaRectToGeckoRectDevPix(
|
||||||
CGFloat aBackingScale)
|
const NSRect& aCocoaRect, CGFloat aBackingScale)
|
||||||
{
|
{
|
||||||
nsIntRect rect;
|
LayoutDeviceIntRect 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,8 +1573,7 @@ NS_IMETHODIMP nsCocoaWindow::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect
|
|||||||
|
|
||||||
CGFloat scaleFactor = BackingScaleFactor();
|
CGFloat scaleFactor = BackingScaleFactor();
|
||||||
if (!mWindow) {
|
if (!mWindow) {
|
||||||
aRect = LayoutDeviceIntRect::FromUnknownRect(
|
aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor);
|
||||||
nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor));
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1586,8 +1585,7 @@ NS_IMETHODIMP nsCocoaWindow::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect
|
|||||||
r = [mWindow contentRectForFrameRect:[mWindow frame]];
|
r = [mWindow contentRectForFrameRect:[mWindow frame]];
|
||||||
}
|
}
|
||||||
|
|
||||||
aRect = LayoutDeviceIntRect::FromUnknownRect(
|
aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(r, scaleFactor);
|
||||||
nsCocoaUtils::CocoaRectToGeckoRectDevPix(r, scaleFactor));
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
@@ -1601,7 +1599,8 @@ nsCocoaWindow::UpdateBounds()
|
|||||||
if (mWindow) {
|
if (mWindow) {
|
||||||
frame = [mWindow frame];
|
frame = [mWindow frame];
|
||||||
}
|
}
|
||||||
mBounds = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
mBounds = nsCocoaUtils::CocoaRectToGeckoRectDevPix(
|
||||||
|
frame, BackingScaleFactor()).ToUnknownRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
|
NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
|
||||||
@@ -1609,8 +1608,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
|
||||||
nsIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix([mWindow frame], BackingScaleFactor());
|
LayoutDeviceIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix([mWindow frame], BackingScaleFactor());
|
||||||
NS_ASSERTION(mWindow && mBounds == r, "mBounds out of sync!");
|
NS_ASSERTION(mWindow && mBounds == r.ToUnknownRect(), "mBounds out of sync!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
||||||
@@ -1986,13 +1985,13 @@ LayoutDeviceIntPoint nsCocoaWindow::WidgetToScreenOffset()
|
|||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||||
|
|
||||||
NSRect rect = NSZeroRect;
|
NSRect rect = NSZeroRect;
|
||||||
nsIntRect r;
|
LayoutDeviceIntRect 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 LayoutDeviceIntPoint::FromUnknownPoint(r.TopLeft());
|
return r.TopLeft();
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
|
||||||
}
|
}
|
||||||
@@ -2019,12 +2018,12 @@ nsCocoaWindow::ClientToWindowSize(const LayoutDeviceIntSize& aClientSize)
|
|||||||
return LayoutDeviceIntSize(0, 0);
|
return LayoutDeviceIntSize(0, 0);
|
||||||
|
|
||||||
CGFloat backingScale = BackingScaleFactor();
|
CGFloat backingScale = BackingScaleFactor();
|
||||||
nsIntRect r(0, 0, aClientSize.width, aClientSize.height);
|
LayoutDeviceIntRect 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 LayoutDeviceIntSize(r.width, r.height);
|
return r.Size();
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntSize(0,0));
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntSize(0,0));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ nsScreenCocoa::GetRect(int32_t *outX, int32_t *outY, int32_t *outWidth, int32_t
|
|||||||
{
|
{
|
||||||
NSRect frame = [mScreen frame];
|
NSRect frame = [mScreen frame];
|
||||||
|
|
||||||
nsIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
LayoutDeviceIntRect r =
|
||||||
|
nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
||||||
|
|
||||||
*outX = r.x;
|
*outX = r.x;
|
||||||
*outY = r.y;
|
*outY = r.y;
|
||||||
@@ -59,7 +60,8 @@ nsScreenCocoa::GetAvailRect(int32_t *outX, int32_t *outY, int32_t *outWidth, int
|
|||||||
{
|
{
|
||||||
NSRect frame = [mScreen visibleFrame];
|
NSRect frame = [mScreen visibleFrame];
|
||||||
|
|
||||||
nsIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
LayoutDeviceIntRect r =
|
||||||
|
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(nsIntRect* aResizerRect)
|
nsBaseWidget::ShowsResizeIndicator(LayoutDeviceIntRect* 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, nsIntRect aRect) override {}
|
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, LayoutDeviceIntRect 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(nsIntRect* aResizerRect) override;
|
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* 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,6 +335,7 @@ 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.
|
||||||
@@ -1258,7 +1259,8 @@ class nsIWidget : public nsISupports {
|
|||||||
*
|
*
|
||||||
* Always called from the compositing thread.
|
* Always called from the compositing thread.
|
||||||
*/
|
*/
|
||||||
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0;
|
virtual void DrawWindowOverlay(LayerManagerComposite* aManager,
|
||||||
|
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.
|
||||||
@@ -1500,7 +1502,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(nsIntRect* aResizerRect) = 0;
|
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user