зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1542454 - Remove support for drawing the window resizer. r=spohl
The last version of macOS that put resizers in window corners was 10.6. Differential Revision: https://phabricator.services.mozilla.com/D26401 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
0f29789b59
Коммит
d0ba1d9725
|
@ -369,7 +369,7 @@ class nsChildView final : public nsBaseWidget {
|
|||
virtual void* GetNativeData(uint32_t aDataType) override;
|
||||
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
|
||||
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override { return false; }
|
||||
|
||||
static bool ConvertStatus(nsEventStatus aStatus) {
|
||||
return aStatus == nsEventStatus_eConsumeNoDefault;
|
||||
|
@ -553,7 +553,6 @@ class nsChildView final : public nsBaseWidget {
|
|||
|
||||
// Overlay drawing functions for OpenGL drawing
|
||||
void DrawWindowOverlay(mozilla::layers::GLManager* aManager, LayoutDeviceIntRect aRect);
|
||||
void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager);
|
||||
void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager,
|
||||
const LayoutDeviceIntRect& aRect);
|
||||
void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager);
|
||||
|
@ -599,8 +598,6 @@ class nsChildView final : public nsBaseWidget {
|
|||
|
||||
// May be accessed from any thread, protected
|
||||
// by mEffectsLock.
|
||||
bool mShowsResizeIndicator;
|
||||
LayoutDeviceIntRect mResizeIndicatorRect;
|
||||
int mDevPixelCornerRadius;
|
||||
bool mIsCoveringTitlebar;
|
||||
bool mIsFullscreen;
|
||||
|
@ -613,7 +610,6 @@ class nsChildView final : public nsBaseWidget {
|
|||
CGContextRef mTitlebarCGContext;
|
||||
|
||||
// Compositor thread only
|
||||
mozilla::UniquePtr<mozilla::widget::RectTextureImage> mResizerImage;
|
||||
mozilla::UniquePtr<mozilla::widget::RectTextureImage> mCornerMaskImage;
|
||||
mozilla::UniquePtr<mozilla::widget::RectTextureImage> mTitlebarImage;
|
||||
mozilla::UniquePtr<mozilla::widget::RectTextureImage> mBasicCompositorImage;
|
||||
|
|
|
@ -322,7 +322,6 @@ nsChildView::nsChildView()
|
|||
mParentWidget(nullptr),
|
||||
mViewTearDownLock("ChildViewTearDown"),
|
||||
mEffectsLock("WidgetEffects"),
|
||||
mShowsResizeIndicator(false),
|
||||
mDevPixelCornerRadius{0},
|
||||
mIsCoveringTitlebar(false),
|
||||
mIsFullscreen(false),
|
||||
|
@ -910,27 +909,6 @@ void nsChildView::Resize(double aX, double aY, double aWidth, double aHeight, bo
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
static const int32_t resizeIndicatorWidth = 15;
|
||||
static const int32_t resizeIndicatorHeight = 15;
|
||||
bool nsChildView::ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) {
|
||||
NSView *topLevelView = mView, *superView = nil;
|
||||
while ((superView = [topLevelView superview])) topLevelView = superView;
|
||||
|
||||
if (![[topLevelView window] showsResizeIndicator] ||
|
||||
!([[topLevelView window] styleMask] & NSResizableWindowMask))
|
||||
return false;
|
||||
|
||||
if (aResizerRect) {
|
||||
NSSize bounds = [topLevelView bounds].size;
|
||||
NSPoint corner = NSMakePoint(bounds.width, [topLevelView isFlipped] ? bounds.height : 0);
|
||||
corner = [topLevelView convertPoint:corner toView:mView];
|
||||
aResizerRect->SetRect(NSToIntRound(corner.x) - resizeIndicatorWidth,
|
||||
NSToIntRound(corner.y) - resizeIndicatorHeight, resizeIndicatorWidth,
|
||||
resizeIndicatorHeight);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult nsChildView::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
int32_t aNativeKeyCode, uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
|
@ -1733,7 +1711,6 @@ void nsChildView::PrepareWindowEffects() {
|
|||
bool canBeOpaque;
|
||||
{
|
||||
MutexAutoLock lock(mEffectsLock);
|
||||
mShowsResizeIndicator = ShowsResizeIndicator(&mResizeIndicatorRect);
|
||||
CGFloat cornerRadius = [mView cornerRadius];
|
||||
mDevPixelCornerRadius = cornerRadius * BackingScaleFactor();
|
||||
mIsCoveringTitlebar = [mView isCoveringTitlebar];
|
||||
|
@ -1763,7 +1740,6 @@ void nsChildView::PrepareWindowEffects() {
|
|||
}
|
||||
|
||||
void nsChildView::CleanupWindowEffects() {
|
||||
mResizerImage = nullptr;
|
||||
mCornerMaskImage = nullptr;
|
||||
mTitlebarImage = nullptr;
|
||||
}
|
||||
|
@ -1852,7 +1828,6 @@ void nsChildView::DrawWindowOverlay(GLManager* aManager, LayoutDeviceIntRect aRe
|
|||
ScopedGLState scopedScissorTestState(gl, LOCAL_GL_SCISSOR_TEST, false);
|
||||
|
||||
MaybeDrawTitlebar(aManager);
|
||||
MaybeDrawResizeIndicator(aManager);
|
||||
MaybeDrawRoundedCorners(aManager, aRect);
|
||||
}
|
||||
|
||||
|
@ -1862,60 +1837,6 @@ static void ClearRegion(gfx::DrawTarget* aDT, LayoutDeviceIntRegion aRegion) {
|
|||
aDT->PopClip();
|
||||
}
|
||||
|
||||
static void DrawResizer(CGContextRef aCtx) {
|
||||
CGContextSetShouldAntialias(aCtx, false);
|
||||
CGPoint points[6];
|
||||
points[0] = CGPointMake(13.0f, 4.0f);
|
||||
points[1] = CGPointMake(3.0f, 14.0f);
|
||||
points[2] = CGPointMake(13.0f, 8.0f);
|
||||
points[3] = CGPointMake(7.0f, 14.0f);
|
||||
points[4] = CGPointMake(13.0f, 12.0f);
|
||||
points[5] = CGPointMake(11.0f, 14.0f);
|
||||
CGContextSetRGBStrokeColor(aCtx, 0.00f, 0.00f, 0.00f, 0.15f);
|
||||
CGContextStrokeLineSegments(aCtx, points, 6);
|
||||
|
||||
points[0] = CGPointMake(13.0f, 5.0f);
|
||||
points[1] = CGPointMake(4.0f, 14.0f);
|
||||
points[2] = CGPointMake(13.0f, 9.0f);
|
||||
points[3] = CGPointMake(8.0f, 14.0f);
|
||||
points[4] = CGPointMake(13.0f, 13.0f);
|
||||
points[5] = CGPointMake(12.0f, 14.0f);
|
||||
CGContextSetRGBStrokeColor(aCtx, 0.13f, 0.13f, 0.13f, 0.54f);
|
||||
CGContextStrokeLineSegments(aCtx, points, 6);
|
||||
|
||||
points[0] = CGPointMake(13.0f, 6.0f);
|
||||
points[1] = CGPointMake(5.0f, 14.0f);
|
||||
points[2] = CGPointMake(13.0f, 10.0f);
|
||||
points[3] = CGPointMake(9.0f, 14.0f);
|
||||
points[5] = CGPointMake(13.0f, 13.9f);
|
||||
points[4] = CGPointMake(13.0f, 14.0f);
|
||||
CGContextSetRGBStrokeColor(aCtx, 0.84f, 0.84f, 0.84f, 0.55f);
|
||||
CGContextStrokeLineSegments(aCtx, points, 6);
|
||||
}
|
||||
|
||||
void nsChildView::MaybeDrawResizeIndicator(GLManager* aManager) {
|
||||
MutexAutoLock lock(mEffectsLock);
|
||||
if (!mShowsResizeIndicator) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mResizerImage) {
|
||||
mResizerImage = MakeUnique<RectTextureImage>();
|
||||
}
|
||||
|
||||
LayoutDeviceIntSize size = mResizeIndicatorRect.Size();
|
||||
mResizerImage->UpdateIfNeeded(
|
||||
size, LayoutDeviceIntRegion(),
|
||||
^(gfx::DrawTarget* drawTarget, const LayoutDeviceIntRegion& updateRegion) {
|
||||
ClearRegion(drawTarget, updateRegion);
|
||||
gfx::BorrowedCGContext borrow(drawTarget);
|
||||
DrawResizer(borrow.cg);
|
||||
borrow.Finish();
|
||||
});
|
||||
|
||||
mResizerImage->Draw(aManager, mResizeIndicatorRect.TopLeft());
|
||||
}
|
||||
|
||||
static CGContextRef CreateCGContext(const LayoutDeviceIntSize& aSize) {
|
||||
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
|
||||
CGContextRef ctx = CGBitmapContextCreate(
|
||||
|
@ -2417,7 +2338,6 @@ void nsChildView::EndRemoteDrawing() {
|
|||
void nsChildView::CleanupRemoteDrawing() {
|
||||
mBasicCompositorImage = nullptr;
|
||||
mCornerMaskImage = nullptr;
|
||||
mResizerImage = nullptr;
|
||||
mTitlebarImage = nullptr;
|
||||
mGLPresenter = nullptr;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче