Skip to content

Commit ce4331d

Browse files
author
Ognjen Sobajic
committed
Win32 builds and runs against 1.0.705.50-prerelease
WPF and WinForms build and run against 1.0.705.50 (release version)
1 parent 7a60335 commit ce4331d

28 files changed

+24
-27
lines changed

SampleApps/WebView2APISample/AppStartPage.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44

55
#include "stdafx.h"
66

7-
#ifdef USE_WEBVIEW2_WIN10
7+
#include <algorithm>
88
#include <pathcch.h>
9-
#else
10-
#include <Shlwapi.h>
11-
#endif
129
#include <Psapi.h>
1310

1411
#include "AppStartPage.h"
@@ -34,16 +31,8 @@ bool AreFileUrisEqual(std::wstring leftUri, std::wstring rightUri)
3431
std::wstring ResolvePathAndTrimFile(std::wstring path)
3532
{
3633
wchar_t resultPath[MAX_PATH];
37-
#ifdef USE_WEBVIEW2_WIN10
3834
PathCchCanonicalize(resultPath, ARRAYSIZE(resultPath), path.c_str());
3935
PathCchRemoveFileSpec(resultPath, ARRAYSIZE(resultPath));
40-
#else
41-
// Surpress compiler warning for PathCanonicalize. It is only used on Win7
42-
// where PathCchCanonicalize doesn't exist.
43-
#pragma warning(suppress : 4995)
44-
PathCanonicalize(resultPath, path.c_str());
45-
PathRemoveFileSpec(resultPath);
46-
#endif
4736
return resultPath;
4837
}
4938

SampleApps/WebView2APISample/AppWindow.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,14 +1245,12 @@ double AppWindow::GetDpiScale()
12451245
return DpiUtil::GetDpiForWindow(m_mainWindow) * 1.0f / USER_DEFAULT_SCREEN_DPI;
12461246
}
12471247

1248+
#ifdef USE_WEBVIEW2_WIN10
12481249
double AppWindow::GetTextScale()
12491250
{
1250-
#ifdef USE_WEBVIEW2_WIN10
12511251
return m_uiSettings ? m_uiSettings.TextScaleFactor() : 1.0f;
1252-
#else
1253-
return 1.0f;
1254-
#endif
12551252
}
1253+
#endif
12561254

12571255
void AppWindow::AddRef()
12581256
{

SampleApps/WebView2APISample/AppWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ class AppWindow
5858
std::wstring GetLocalUri(std::wstring path);
5959
std::function<void()> GetAcceleratorKeyFunction(UINT key);
6060
double GetDpiScale();
61+
#ifdef USE_WEBVIEW2_WIN10
6162
double GetTextScale();
63+
#endif
6264

6365
void ReinitializeWebView();
6466

SampleApps/WebView2APISample/Toolbar.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,14 @@ void Toolbar::UpdateFont()
137137
LOGFONT logFont;
138138
GetObject(GetStockObject(SYSTEM_FONT), sizeof(LOGFONT), &logFont);
139139
double dpiScale = m_appWindow->GetDpiScale();
140+
#ifdef USE_WEBVIEW2_WIN10
140141
double textScale = m_appWindow->GetTextScale();
141142
logFont.lfHeight *= dpiScale * textScale;
142143
logFont.lfWidth *= dpiScale * textScale;
144+
#else
145+
logFont.lfHeight *= dpiScale;
146+
logFont.lfWidth *= dpiScale;
147+
#endif
143148
StringCchCopy(logFont.lfFaceName, ARRAYSIZE(logFont.lfFaceName), s_fontName);
144149
m_font = CreateFontIndirect(&logFont);
145150
}

SampleApps/WebView2APISample/ViewComponent.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ bool ViewComponent::HandleWindowMessage(
221221
SetRasterizationScale(1.5f);
222222
return true;
223223
case IDM_BOUNDS_MODE_RAW_PIXELS:
224-
SetBoundsMode(COREWEBVIEW2_BOUNDS_MODE_USE_RAW_PIXELS);
224+
SetBoundsMode(COREWEBVIEW2_USE_RAW_PIXELS);
225225
return true;
226226
case IDM_BOUNDS_MODE_VIEW_PIXELS:
227-
SetBoundsMode(COREWEBVIEW2_BOUNDS_MODE_USE_RASTERIZATION_SCALE);
227+
SetBoundsMode(COREWEBVIEW2_USE_RASTERIZATION_SCALE);
228228
return true;
229229
case IDM_SCALE_50:
230230
SetScale(0.5f);
@@ -496,8 +496,7 @@ void ViewComponent::SetRasterizationScale(float additionalScale)
496496
additionalScale * m_appWindow->GetDpiScale() * m_appWindow->GetTextScale();
497497
#else
498498
additionalScale;
499-
#endif
500-
CHECK_FAILURE(m_controllerExperimental->put_RasterizationScale(rasterizationScale));
499+
#endif CHECK_FAILURE(m_controllerExperimental->put_RasterizationScale(rasterizationScale));
501500
}
502501
//! [RasterizationScale]
503502

SampleApps/WebView2APISample/ViewComponent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ViewComponent : public ComponentBase
8484
bool m_useCursorId = false;
8585
wil::com_ptr<DropTarget> m_dropTarget;
8686
float m_webviewAdditionalRasterizationScale = 1.0f;
87-
COREWEBVIEW2_BOUNDS_MODE m_boundsMode = COREWEBVIEW2_BOUNDS_MODE_USE_RAW_PIXELS;
87+
COREWEBVIEW2_BOUNDS_MODE m_boundsMode = COREWEBVIEW2_USE_RAW_PIXELS;
8888

8989
EventRegistrationToken m_zoomFactorChangedToken = {};
9090
EventRegistrationToken m_rasterizationScaleChangedToken = {};
-2.84 KB
Loading
-56.5 KB
Loading
-2.45 KB
Loading
-2.88 KB
Loading

0 commit comments

Comments
 (0)