Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cool#4250 - dpiscale: propagate from the client to the view via new l… #10515

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions browser/src/layer/tile/CanvasTileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1030,9 +1030,11 @@ L.CanvasTileLayer = L.Layer.extend({
return;

var newClientZoom = 'tilepixelwidth=' + this._tileWidthPx + ' ' +
'tilepixelheight=' + this._tileHeightPx + ' ' +
'tiletwipwidth=' + this._tileWidthTwips + ' ' +
'tiletwipheight=' + this._tileHeightTwips;
'tilepixelheight=' + this._tileHeightPx + ' ' +
'tiletwipwidth=' + this._tileWidthTwips + ' ' +
'tiletwipheight=' + this._tileHeightTwips + ' ' +
'dpiscale=' + window.devicePixelRatio + ' ' +
'zoom=' + this._map.getZoom()

if (this._clientZoom !== newClientZoom || forceUpdate) {
// the zoom level has changed
Expand Down
12 changes: 11 additions & 1 deletion kit/ChildSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,8 +1189,9 @@ bool ChildSession::getCommandValues(const StringVector& tokens)
bool ChildSession::clientZoom(const StringVector& tokens)
{
int tilePixelWidth, tilePixelHeight, tileTwipWidth, tileTwipHeight;
std::string dpiScale, zoom;

if (tokens.size() != 5 ||
if (tokens.size() < 5 ||
!getTokenInteger(tokens[1], "tilepixelwidth", tilePixelWidth) ||
!getTokenInteger(tokens[2], "tilepixelheight", tilePixelHeight) ||
!getTokenInteger(tokens[3], "tiletwipwidth", tileTwipWidth) ||
Expand All @@ -1203,6 +1204,15 @@ bool ChildSession::clientZoom(const StringVector& tokens)
getLOKitDocument()->setView(_viewId);

getLOKitDocument()->setClientZoom(tilePixelWidth, tilePixelHeight, tileTwipWidth, tileTwipHeight);

if (tokens.size() == 7 &&
getTokenString(tokens[5], "dpiscale", dpiScale) &&
getTokenString(tokens[6], "zoom", zoom))
{
getLOKitDocument()->setViewOption("dpiscale", dpiScale.c_str());
getLOKitDocument()->setViewOption("zoom", zoom.c_str());
}

return true;
}

Expand Down
3 changes: 2 additions & 1 deletion wsd/ClientSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,8 @@ bool ClientSession::_handleInput(const char *buffer, int length)
else if (tokens.equals(0, "clientzoom"))
{
int tilePixelWidth, tilePixelHeight, tileTwipWidth, tileTwipHeight;
if (tokens.size() != 5 ||
std::string dpiScaleStr;
if (tokens.size() < 5 ||
!getTokenInteger(tokens[1], "tilepixelwidth", tilePixelWidth) ||
!getTokenInteger(tokens[2], "tilepixelheight", tilePixelHeight) ||
!getTokenInteger(tokens[3], "tiletwipwidth", tileTwipWidth) ||
Expand Down
1 change: 1 addition & 0 deletions wsd/ClientSession.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ class ClientSession final : public Session
int _tileHeightPixel;
int _tileWidthTwips;
int _tileHeightTwips;
double _dpiScale;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This _dpiScale member isn't used (and same for local var dpiScaleStr in ClientSession.cpp). I imagine we don't actually need those if we are just passing through the message from CanvasTileLayer.js?


/// The integer id of the view in the Kit process
int _kitViewId;
Expand Down
Loading