-
Notifications
You must be signed in to change notification settings - Fork 693
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TabView continuous expansions fix (#6954)
* Reverting product change made for 'TabView gap between active tab and active content fix #6644' * TabView expansions fix
- Loading branch information
Showing
9 changed files
with
283 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
#pragma once | ||
|
||
#include "common.h" | ||
#include "TraceLogging.h" | ||
#include "Utils.h" | ||
#include "MUXControlsTestHooks.h" | ||
|
||
inline bool IsTabViewTracingEnabled() | ||
{ | ||
return g_IsLoggingProviderEnabled && | ||
g_LoggingProviderLevel >= WINEVENT_LEVEL_INFO && | ||
(g_LoggingProviderMatchAnyKeyword & KEYWORD_TABVIEW || g_LoggingProviderMatchAnyKeyword == 0); | ||
} | ||
|
||
inline bool IsTabViewVerboseTracingEnabled() | ||
{ | ||
return g_IsLoggingProviderEnabled && | ||
g_LoggingProviderLevel >= WINEVENT_LEVEL_VERBOSE && | ||
(g_LoggingProviderMatchAnyKeyword & KEYWORD_TABVIEW || g_LoggingProviderMatchAnyKeyword == 0); | ||
} | ||
|
||
inline bool IsTabViewPerfTracingEnabled() | ||
{ | ||
return g_IsPerfProviderEnabled && | ||
g_PerfProviderLevel >= WINEVENT_LEVEL_INFO && | ||
(g_PerfProviderMatchAnyKeyword & KEYWORD_TABVIEW || g_PerfProviderMatchAnyKeyword == 0); | ||
} | ||
|
||
#define TABVIEW_TRACE_INFO_ENABLED(includeTraceLogging, sender, message, ...) \ | ||
TabViewTrace::TraceInfo(includeTraceLogging, sender, message, __VA_ARGS__); \ | ||
|
||
#define TABVIEW_TRACE_INFO(sender, message, ...) \ | ||
if (IsTabViewTracingEnabled()) \ | ||
{ \ | ||
TABVIEW_TRACE_INFO_ENABLED(true /*includeTraceLogging*/, sender, message, __VA_ARGS__); \ | ||
} \ | ||
else if (TabViewTrace::s_IsDebugOutputEnabled || TabViewTrace::s_IsVerboseDebugOutputEnabled) \ | ||
{ \ | ||
TABVIEW_TRACE_INFO_ENABLED(false /*includeTraceLogging*/, sender, message, __VA_ARGS__); \ | ||
} \ | ||
|
||
#define TABVIEW_TRACE_VERBOSE_ENABLED(includeTraceLogging, sender, message, ...) \ | ||
TabViewTrace::TraceVerbose(includeTraceLogging, sender, message, __VA_ARGS__); \ | ||
|
||
#define TABVIEW_TRACE_VERBOSE(sender, message, ...) \ | ||
if (IsTabViewVerboseTracingEnabled()) \ | ||
{ \ | ||
TABVIEW_TRACE_VERBOSE_ENABLED(true /*includeTraceLogging*/, sender, message, __VA_ARGS__); \ | ||
} \ | ||
else if (TabViewTrace::s_IsVerboseDebugOutputEnabled) \ | ||
{ \ | ||
TABVIEW_TRACE_VERBOSE_ENABLED(false /*includeTraceLogging*/, sender, message, __VA_ARGS__); \ | ||
} \ | ||
|
||
#define TABVIEW_TRACE_PERF(info) \ | ||
if (IsTabViewPerfTracingEnabled()) \ | ||
{ \ | ||
TabViewTrace::TracePerfInfo(info); \ | ||
} \ | ||
|
||
class TabViewTrace | ||
{ | ||
public: | ||
static bool s_IsDebugOutputEnabled; | ||
static bool s_IsVerboseDebugOutputEnabled; | ||
|
||
static void TraceInfo(bool includeTraceLogging, const winrt::IInspectable& sender, PCWSTR message, ...) noexcept | ||
{ | ||
va_list args; | ||
va_start(args, message); | ||
WCHAR buffer[384]{}; | ||
if (SUCCEEDED(StringCchVPrintfW(buffer, ARRAYSIZE(buffer), message, args))) | ||
{ | ||
if (includeTraceLogging) | ||
{ | ||
// TraceViewers | ||
// http://toolbox/pef | ||
// http://fastetw/index.aspx | ||
TraceLoggingWrite( | ||
g_hLoggingProvider, | ||
"TabViewInfo" /* eventName */, | ||
TraceLoggingLevel(WINEVENT_LEVEL_INFO), | ||
TraceLoggingKeyword(KEYWORD_TABVIEW), | ||
TraceLoggingWideString(buffer, "Message")); | ||
} | ||
|
||
if (s_IsDebugOutputEnabled) | ||
{ | ||
OutputDebugStringW(buffer); | ||
} | ||
|
||
com_ptr<MUXControlsTestHooks> globalTestHooks = MUXControlsTestHooks::GetGlobalTestHooks(); | ||
|
||
if (globalTestHooks && | ||
(globalTestHooks->GetLoggingLevelForType(L"TabView") >= WINEVENT_LEVEL_INFO || globalTestHooks->GetLoggingLevelForInstance(sender) >= WINEVENT_LEVEL_INFO)) | ||
{ | ||
globalTestHooks->LogMessage(sender, buffer, false /*isVerboseLevel*/); | ||
} | ||
} | ||
va_end(args); | ||
} | ||
|
||
static void TraceVerbose(bool includeTraceLogging, const winrt::IInspectable& sender, PCWSTR message, ...) noexcept | ||
{ | ||
va_list args; | ||
va_start(args, message); | ||
WCHAR buffer[1024]{}; | ||
const HRESULT hr = StringCchVPrintfW(buffer, ARRAYSIZE(buffer), message, args); | ||
if (SUCCEEDED(hr) || hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) | ||
{ | ||
if (includeTraceLogging) | ||
{ | ||
// TraceViewers | ||
// http://toolbox/pef | ||
// http://fastetw/index.aspx | ||
TraceLoggingWrite( | ||
g_hLoggingProvider, | ||
"TabViewVerbose" /* eventName */, | ||
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE), | ||
TraceLoggingKeyword(KEYWORD_TABVIEW), | ||
TraceLoggingWideString(buffer, "Message")); | ||
} | ||
|
||
if (s_IsDebugOutputEnabled || s_IsVerboseDebugOutputEnabled) | ||
{ | ||
OutputDebugStringW(buffer); | ||
} | ||
|
||
com_ptr<MUXControlsTestHooks> globalTestHooks = MUXControlsTestHooks::GetGlobalTestHooks(); | ||
|
||
if (globalTestHooks && | ||
(globalTestHooks->GetLoggingLevelForType(L"TabView") >= WINEVENT_LEVEL_VERBOSE || globalTestHooks->GetLoggingLevelForInstance(sender) >= WINEVENT_LEVEL_VERBOSE)) | ||
{ | ||
globalTestHooks->LogMessage(sender, buffer, true /*isVerboseLevel*/); | ||
} | ||
} | ||
va_end(args); | ||
} | ||
|
||
static void TracePerfInfo(PCWSTR info) noexcept | ||
{ | ||
// TraceViewers | ||
// http://toolbox/pef | ||
// http://fastetw/index.aspx | ||
TraceLoggingWrite( | ||
g_hPerfProvider, | ||
"TabViewPerf" /* eventName */, | ||
TraceLoggingLevel(WINEVENT_LEVEL_INFO), | ||
TraceLoggingKeyword(KEYWORD_TABVIEW), | ||
TraceLoggingWideString(info, "Info")); | ||
} | ||
}; |
Oops, something went wrong.