Skip to content

Commit

Permalink
Syncing content from committish 8aca00e68ab1581c22aaec791c4d9157cf0f9f0f
Browse files Browse the repository at this point in the history
  • Loading branch information
reunion-maestro-bot committed Jun 11, 2024
1 parent 2a60e27 commit 98a60c8
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 19 deletions.
14 changes: 13 additions & 1 deletion dxaml/xcp/components/imaging/SvgImageDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include <Corep.h>
#include <d2d1_3.h>
#include <WicService.h>
#include <FrameworkUdk/Containment.h>

// Bug 50717750: [1.5 Servicing][WASDK] [GitHub] SVG not longer rendering
#define WINAPPSDK_CHANGEID_50717750 50717750

using namespace DirectUI;

Expand Down Expand Up @@ -215,8 +219,16 @@ _Check_return_ HRESULT SvgImageDecoder::DecodeFrame(
{
if (!hasWidth && !hasHeight)
{
// If neither width nor height was specified, then just match the viewBoxes.
// If neither width nor height was specified, then just match the viewBoxes...
containerViewBox = originalViewBox;

if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_50717750>())
{
// ...but reset the origin of the view box for the outer SVG. The inner SVG will be positioned at
// the origin when it's stretched (1:1) in the outer SVG.
containerViewBox.x = 0;
containerViewBox.y = 0;
}
}
else
{
Expand Down
1 change: 1 addition & 0 deletions dxaml/xcp/components/unittest.props
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
onecoreuap.lib;
ntdll.lib;
dbghelp.lib;
$(FrameworkUdkLibPath)\Microsoft.Internal.FrameworkUdk.lib;
</AdditionalDependencies>

<DelayLoadDLLs>api-ms-win-rtcore-ntuser-private-l1-*.dll;</DelayLoadDLLs>
Expand Down
26 changes: 26 additions & 0 deletions dxaml/xcp/core/dll/focusmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@
#include <FocusManagerLostFocusEventArgs.h>
#include <FocusManagerGotFocusEventArgs.h>

#include <DXamlServices.h>

#include "InitialFocusSIPSuspender.h"
#include "FocusLockOverrideGuard.h"
#include <FrameworkUdk/Containment.h>

// Bug 51401727: [1.5 Servicing][WASDK] [GitHub] Webview2: Window blur and focus events always fire when clicking the WebView
#define WINAPPSDK_CHANGEID_51401727 51401727

#define E_FOCUS_ASYNCOP_INPROGRESS 64L

Expand Down Expand Up @@ -1780,6 +1786,26 @@ bool CFocusManager::ShouldSetWindowFocus(const FocusMovement& movement) const
return false;
}

if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_51401727>())
{
// If focused element is hwnd-based component hosted inside the Xaml island (aka WebView2), don't set focus to the hwnd,
// to avoid Xaml stealing focus back after the user interacts with the component hwnd, and focus is already there.
if (m_pFocusedElement && m_pFocusedElement->GetTypeIndex() == KnownTypeIndex::Panel)
{
HWND componentHwnd = DXamlServices::GetComponentHwndForPeer(m_pFocusedElement);
if(componentHwnd)
{
HWND focusedHwnd = ::GetFocus();
// Check if the componendHwnd has focus or its child has
// https://task.ms/49085931 - [API Gap] InputFocusController needs some sort of ContainsFocus API to detect when Focus is in nested Content (eg XAML and a WebView2)
if (componentHwnd == focusedHwnd || ::IsChild(componentHwnd, focusedHwnd))
{
return false;
}
}
}
}

return true;
}

Expand Down
1 change: 1 addition & 0 deletions dxaml/xcp/core/inc/DXamlServices.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ namespace DirectUI
wuc::ICoreWindow* GetCurrentCoreWindowNoRef();
bool HasCompositionTargetRenderedEventHandlers();
bool IsInBackgroundTask();
HWND GetComponentHwndForPeer(_In_ CDependencyObject* pDO);
}
}
19 changes: 19 additions & 0 deletions dxaml/xcp/dxaml/lib/DXamlServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "JupiterControl.h"
#include "JupiterWindow.h"

#include <IHwndComponentHost.h>

#pragma warning(disable:4267) //'var' : conversion from 'size_t' to 'type', possible loss of data

namespace DirectUI
Expand Down Expand Up @@ -213,5 +215,22 @@ namespace DirectUI
{
return !!GetHandle()->IsInBackgroundTask();
}


HWND GetComponentHwndForPeer(_In_ CDependencyObject* pDO)
{
ctl::ComPtr<DirectUI::DependencyObject> peer;
DXamlCore::GetCurrent()->TryGetPeer(pDO, &peer);
if (peer)
{
ctl::ComPtr<IHwndComponentHost> host;
HRESULT qiResult = ctl::iinspectable_cast(peer.Get())->QueryInterface(__uuidof(IHwndComponentHost), reinterpret_cast<void**>(host.ReleaseAndGetAddressOf()));
if (SUCCEEDED(qiResult) && host != nullptr)
{
return host->GetComponentHwnd();
}
}
return nullptr;
}
}
}
16 changes: 8 additions & 8 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
<!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.WindowsAppSDK.Foundation.TransportPackage" Version="1.5.0-20240426.0">
<Dependency Name="Microsoft.WindowsAppSDK.Foundation.TransportPackage" Version="1.5.0-20240606.2.release">
<Uri>https://dev.azure.com/microsoft/ProjectReunion/_git/WindowsAppSDK</Uri>
<Sha>a10039cc791b70b6b9b6a2703ba862e589d5989b</Sha>
<Sha>f2f6538eacbbe1632040c207cde16b5413fb07bf</Sha>
</Dependency>
<Dependency Name="Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage" Version="1.5.4-CI-26105.1000.240425-1532.1">
<Dependency Name="Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage" Version="1.5.4-CI-26105.1001.240605-1418.7">
<Uri>https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP</Uri>
<Sha>d60cf9c7a3bfe26772925fcefefa35d51e924919</Sha>
<Sha>8ae48bdfe2603ad520a56f5bcd40e136c2026c0e</Sha>
</Dependency>
<Dependency Name="Microsoft.Internal.InteractiveExperiences" Version="1.5.4-CI-26105.1000.240425-1532.1">
<Dependency Name="Microsoft.Internal.InteractiveExperiences" Version="1.5.4-CI-26105.1001.240605-1418.7">
<Uri>https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP</Uri>
<Sha>d60cf9c7a3bfe26772925fcefefa35d51e924919</Sha>
<Sha>8ae48bdfe2603ad520a56f5bcd40e136c2026c0e</Sha>
</Dependency>
<!-- Microsoft-WinUI-SDK repo (MSBuild and Visual Studio extensions for building, deploying, and debugging packaged applications.) -->
<Dependency Name="Microsoft.Build.Msix" Version="1.5.0-zmain.231129.0">
<Dependency Name="Microsoft.Build.Msix" Version="1.5.0-zmain.240510.2">
<Uri>https://dev.azure.com/microsoft/WinUI/_git/Microsoft-WinUI-Sdk</Uri>
<Sha>7febe557e6f0e1c3d30254648d58e7b73589a572</Sha>
<Sha>991614b101e9987684a5550327b0aac4c97347ff</Sha>
</Dependency>
<!-- Closed source binary (ex PTLS and WinUIEdit) -->
<Dependency Name="Microsoft.Internal.WinUIDetails" Version="1.500.0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1504,13 +1504,20 @@ public void ProcessBindings(global::System.Object item, int itemIndex, int phase

this.Write(";\r\n this.SetDataRoot(item);\r\n if (!" +
"removedDataContextHandler)\r\n {\r\n " +
" removedDataContextHandler = true;\r\n ");
" removedDataContextHandler = true;\r\n var rootElemen" +
"t = ");

this.Write(this.ToStringHelper.ToStringWithCulture(bindUniverse.RootElement.ReferenceExpression));

this.Write(".DataContextChanged -= this.DataContextChangedHandler;\r\n }" +
"\r\n this.initialized = true;\r\n brea" +
"k;\r\n");
this.Write(@";
if (rootElement != null)
{
rootElement.DataContextChanged -= this.DataContextChangedHandler;
}
}
this.initialized = true;
break;
");

foreach(KeyValuePair<int, List<PhaseAssignment>> kvp in bindUniverse.PhaseAssignments.Where(kvp => kvp.Key != 0).OrderBy(kvp => kvp.Key))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,11 @@ namespace <#=Model.CodeInfo.ClassName.Namespace#>
if (!removedDataContextHandler)
{
removedDataContextHandler = true;
<#=bindUniverse.RootElement.ReferenceExpression#>.DataContextChanged -= this.DataContextChangedHandler;
var rootElement = <#=bindUniverse.RootElement.ReferenceExpression#>;
if (rootElement != null)
{
rootElement.DataContextChanged -= this.DataContextChangedHandler;
}
}
this.initialized = true;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,20 @@ void ProcessBindings(IInspectable const& item, int itemIndex, int phase, int32_t
nextPhase = ");
this.Write(this.ToStringHelper.ToStringWithCulture(bindUniverse.GetNextPhase(0)));
this.Write(";\r\n SetDataRoot(item);\r\n if (_dataContextCh" +
"angedToken.value != 0)\r\n {\r\n ");
"angedToken.value != 0)\r\n {\r\n auto root" +
"Element = ");
this.Write(this.ToStringHelper.ToStringWithCulture(bindUniverse.RootElement.ReferenceExpression));
this.Write(".DataContextChanged(_dataContextChangedToken);\r\n _dataCont" +
"extChangedToken.value = 0;\r\n }\r\n _isInitia" +
"lized = true;\r\n }\r\n break;\r\n");
this.Write(@";
if (rootElement != nullptr)
{
rootElement.DataContextChanged(_dataContextChangedToken);
}
_dataContextChangedToken.value = 0;
}
_isInitialized = true;
}
break;
");
foreach(KeyValuePair<int, List<PhaseAssignment>> kvp in bindUniverse.PhaseAssignments.Where(kvp => kvp.Key != 0).OrderBy(kvp => kvp.Key)) {
this.Write(" case ");
this.Write(this.ToStringHelper.ToStringWithCulture(kvp.Key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@
SetDataRoot(item);
if (_dataContextChangedToken.value != 0)
{
<#=bindUniverse.RootElement.ReferenceExpression#>.DataContextChanged(_dataContextChangedToken);
auto rootElement = <#=bindUniverse.RootElement.ReferenceExpression#>;
if (rootElement != nullptr)
{
rootElement.DataContextChanged(_dataContextChangedToken);
}
_dataContextChangedToken.value = 0;
}
_isInitialized = true;
Expand Down

0 comments on commit 98a60c8

Please sign in to comment.