diff --git a/additions/juggler/TargetRegistry.js b/additions/juggler/TargetRegistry.js index 77277ad..4a73580 100644 --- a/additions/juggler/TargetRegistry.js +++ b/additions/juggler/TargetRegistry.js @@ -394,7 +394,6 @@ class PageTarget { height: ChromeUtils.camouGetInt("window.innerHeight") || 720, }; } - this._zoom = 1; this._initialDPPX = this._linkedBrowser.browsingContext.overrideDPPX; this._url = 'about:blank'; this._openerId = opener ? opener.id() : undefined; @@ -507,7 +506,6 @@ class PageTarget { this.updateUserAgent(browsingContext); this.updatePlatform(browsingContext); this.updateDPPXOverride(browsingContext); - this.updateZoom(browsingContext); this.updateEmulatedMedia(browsingContext); this.updateColorSchemeOverride(browsingContext); this.updateReducedMotionOverride(browsingContext); @@ -546,16 +544,7 @@ class PageTarget { } updateDPPXOverride(browsingContext = undefined) { - browsingContext ||= this._linkedBrowser.browsingContext; - const dppx = this._zoom * (this._browserContext.deviceScaleFactor || this._initialDPPX); - browsingContext.overrideDPPX = dppx; - } - - async updateZoom(browsingContext = undefined) { - browsingContext ||= this._linkedBrowser.browsingContext; - // Update dpr first, and then UI zoom. - this.updateDPPXOverride(browsingContext); - browsingContext.fullZoom = this._zoom; + (browsingContext || this._linkedBrowser.browsingContext).overrideDPPX = this._browserContext.deviceScaleFactor || this._initialDPPX; } _updateModalDialogs() { @@ -617,7 +606,7 @@ class PageTarget { const toolbarTop = stackRect.y; this._window.resizeBy(width - this._window.innerWidth, height + toolbarTop - this._window.innerHeight); - await this._channel.connect('').send('awaitViewportDimensions', { width: width / this._zoom, height: height / this._zoom }); + await this._channel.connect('').send('awaitViewportDimensions', { width, height }); } else { this._linkedBrowser.style.removeProperty('width'); this._linkedBrowser.style.removeProperty('height'); @@ -629,8 +618,8 @@ class PageTarget { const actualSize = this._linkedBrowser.getBoundingClientRect(); await this._channel.connect('').send('awaitViewportDimensions', { - width: actualSize.width / this._zoom, - height: actualSize.height / this._zoom, + width: actualSize.width, + height: actualSize.height, }); } } @@ -682,14 +671,6 @@ class PageTarget { this._viewportSize = viewportSize; await this.updateViewportSize(); } - - async setZoom(zoom) { - // This is default range from the ZoomManager. - if (zoom < 0.3 || zoom > 5) - throw new Error('Invalid zoom value, must be between 0.3 and 5'); - this._zoom = zoom; - await this.updateZoom(); - } close(runBeforeUnload = false) { this._gBrowser.removeTab(this._tab, { diff --git a/additions/juggler/protocol/BrowserHandler.js b/additions/juggler/protocol/BrowserHandler.js index 6a4688e..81aeee4 100644 --- a/additions/juggler/protocol/BrowserHandler.js +++ b/additions/juggler/protocol/BrowserHandler.js @@ -219,6 +219,10 @@ class BrowserHandler { await this._targetRegistry.browserContextForId(browserContextId).setForcedColors(nullToUndefined(forcedColors)); } + async ['Browser.setContrast']({browserContextId, contrast}) { + return; // TODO: Implement + } + async ['Browser.setVideoRecordingOptions']({browserContextId, options}) { await this._targetRegistry.browserContextForId(browserContextId).setVideoRecordingOptions(options); } diff --git a/additions/juggler/protocol/PageHandler.js b/additions/juggler/protocol/PageHandler.js index 6a2fac9..213ede0 100644 --- a/additions/juggler/protocol/PageHandler.js +++ b/additions/juggler/protocol/PageHandler.js @@ -250,10 +250,6 @@ class PageHandler { await this._pageTarget.setViewportSize(viewportSize === null ? undefined : viewportSize); } - async ['Page.setZoom']({zoom}) { - await this._pageTarget.setZoom(zoom); - } - async ['Runtime.evaluate'](options) { return await this._contentPage.send('evaluate', options); } diff --git a/additions/juggler/protocol/Protocol.js b/additions/juggler/protocol/Protocol.js index 6fa3dc8..08ca173 100644 --- a/additions/juggler/protocol/Protocol.js +++ b/additions/juggler/protocol/Protocol.js @@ -463,6 +463,12 @@ const Browser = { forcedColors: t.Nullable(t.Enum(['active', 'none'])), }, }, + 'setContrast': { + params: { + browserContextId: t.Optional(t.String), + contrast: t.Nullable(t.Enum(['less', 'more', 'custom', 'no-preference'])), + }, + }, 'setVideoRecordingOptions': { params: { browserContextId: t.Optional(t.String), @@ -794,11 +800,6 @@ const Page = { viewportSize: t.Nullable(pageTypes.Size), }, }, - 'setZoom': { - params: { - zoom: t.Number, - }, - }, 'bringToFront': { params: { }, diff --git a/additions/juggler/screencast/nsScreencastService.cpp b/additions/juggler/screencast/nsScreencastService.cpp index f33294b..062a851 100644 --- a/additions/juggler/screencast/nsScreencastService.cpp +++ b/additions/juggler/screencast/nsScreencastService.cpp @@ -343,17 +343,10 @@ nsresult nsScreencastService::StartVideoRecording(nsIScreencastServiceClient* aC return NS_ERROR_FAILURE; gfx::IntMargin margin; - // Screen bounds is the widget location on screen. - auto screenBounds = widget->GetScreenBounds().ToUnknownRect(); - // Client bounds is the content location, in terms of parent widget. - // To use it, we need to translate it to screen coordinates first. + auto bounds = widget->GetScreenBounds().ToUnknownRect(); auto clientBounds = widget->GetClientBounds().ToUnknownRect(); - for (auto parent = widget->GetParent(); parent != nullptr; parent = parent->GetParent()) { - auto pb = parent->GetClientBounds().ToUnknownRect(); - clientBounds.MoveBy(pb.X(), pb.Y()); - } // Crop the image to exclude frame (if any). - margin = screenBounds - clientBounds; + margin = bounds - clientBounds; // Crop the image to exclude controls. margin.top += offsetTop; @@ -398,4 +391,4 @@ nsresult nsScreencastService::ScreencastFrameAck(const nsAString& aSessionId) { return NS_OK; } -} // namespace mozilla \ No newline at end of file +} // namespace mozilla