Loading dom/base/Selection.cpp +6 −8 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ static void LogSelectionAPI(const dom::Selection* aSelection, const nsINode* aNode) { MOZ_LOG_FMT(sSelectionAPILog, LogLevel::Info, "{} Selection::{}({}={})", static_cast<const void*>(aSelection), aFuncName, aArgName, ToString(RefPtr{aNode})); RefPtr{aNode}); } static void LogSelectionAPI(const dom::Selection* aSelection, Loading @@ -177,7 +177,7 @@ static void LogSelectionAPI(const dom::Selection* aSelection, MOZ_LOG_FMT(sSelectionAPILog, LogLevel::Info, "{} Selection::{}({}={}, {}={})", static_cast<const void*>(aSelection), aFuncName, aArgName1, ToString(RefPtr{aNode}), aArgName2, aOffset); RefPtr{aNode}, aArgName2, aOffset); } static void LogSelectionAPI(const dom::Selection* aSelection, Loading Loading @@ -3155,12 +3155,10 @@ void Selection::ExtendInternal(nsINode& aContainer, uint32_t aOffset, if (aContainer.GetFrameSelection() != mFrameSelection) { NS_ASSERTION( false, nsFmtCString( "mFrameSelection is {} which is expected as " fmt::format("mFrameSelection is {} which is expected as " "aContainer.GetFrameSelection() ({})", mozilla::ToString(mFrameSelection).c_str(), mozilla::ToString(RefPtr{aContainer.GetFrameSelection()}).c_str()) .get()); mFrameSelection, RefPtr{aContainer.GetFrameSelection()}) .c_str()); aRv.Throw(NS_ERROR_FAILURE); return; } Loading dom/events/IMEStateManager.cpp +37 −37 Original line number Diff line number Diff line Loading @@ -661,33 +661,29 @@ nsresult IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, sFocusedElement.get() == aElement && aAction.mFocusChange != InputContextAction::MENU_GOT_PSEUDO_FOCUS; MOZ_LOG( MOZ_LOG_FMT( sISMLog, LogLevel::Info, ("OnChangeFocusInternal(aPresContext=0x%p (available: %s), " "aElement=0x%p (remote: %s), aAction={ mCause=%s, " "mFocusChange=%s }), sFocusedPresContext=0x%p (available: %s), " "sFocusedElement=0x%p, sTextInputHandlingWidget=0x%p (available: %s), " "BrowserParent::GetFocused()=0x%p, sActiveIMEContentObserver=0x%p, " "sInstalledMenuKeyboardListener=%s, sIsActive=%s, " "restoringContextForRemoteContent=%s", aPresContext, TrueOrFalse(CanHandleWith(aPresContext)), aElement, TrueOrFalse(remoteHasFocus), ToString(aAction.mCause).c_str(), ToString(aAction.mFocusChange).c_str(), sFocusedPresContext.get(), TrueOrFalse(CanHandleWith(sFocusedPresContext)), sFocusedElement.get(), sTextInputHandlingWidget, "OnChangeFocusInternal(\naPresContext={} (available: {}),\n" "aElement={} (remote: {}),\n" "aAction={{ mCause={}, mFocusChange={} }}),\n" "sFocusedPresContext={} (available: {}),\n" "sFocusedElement={},\n" "sTextInputHandlingWidget={} (available: {}), " "BrowserParent::GetFocused()={}, sActiveIMEContentObserver={}, " "sInstalledMenuKeyboardListener={}, sIsActive={}, " "restoringContextForRemoteContent={}", static_cast<void*>(aPresContext), TrueOrFalse(CanHandleWith(aPresContext)), RefPtr{aElement}, TrueOrFalse(remoteHasFocus), ToString(aAction.mCause), ToString(aAction.mFocusChange), static_cast<void*>(sFocusedPresContext), TrueOrFalse(CanHandleWith(sFocusedPresContext)), sFocusedElement, static_cast<void*>(sTextInputHandlingWidget), TrueOrFalse(sTextInputHandlingWidget && !sTextInputHandlingWidget->Destroyed()), BrowserParent::GetFocused(), sActiveIMEContentObserver.get(), static_cast<void*>(BrowserParent::GetFocused()), static_cast<void*>(sActiveIMEContentObserver), TrueOrFalse(sInstalledMenuKeyboardListener), TrueOrFalse(sIsActive), TrueOrFalse(restoringContextForRemoteContent))); if (aElement) { MOZ_LOG(sISMLog, LogLevel::Debug, (" aElement: %s", ToString(*aElement).c_str())); } if (sFocusedElement) { MOZ_LOG(sISMLog, LogLevel::Debug, (" sFocusedElement: %s", ToString(*sFocusedElement).c_str())); } TrueOrFalse(restoringContextForRemoteContent)); sIsActive = !!aPresContext; if (sPendingFocusedBrowserSwitchingData.isSome()) { Loading Loading @@ -946,18 +942,22 @@ nsresult IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, // static void IMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling) { MOZ_LOG( MOZ_LOG_FMT( sISMLog, LogLevel::Info, ("OnInstalledMenuKeyboardListener(aInstalling=%s), " "nsContentUtils::IsSafeToRunScript()=%s, " "sInstalledMenuKeyboardListener=%s, BrowserParent::GetFocused()=0x%p, " "sActiveChildInputContext=%s, sFocusedPresContext=0x%p, " "sFocusedElement=0x%p, sPseudoFocusChangeRunnable=0x%p", "OnInstalledMenuKeyboardListener(aInstalling={}), " "nsContentUtils::IsSafeToRunScript()={}, " "sInstalledMenuKeyboardListener={}, BrowserParent::GetFocused()={}, " "sActiveChildInputContext={},\n" "sFocusedPresContext={},\n" "sFocusedElement={},\n" "sPseudoFocusChangeRunnable={}", TrueOrFalse(aInstalling), TrueOrFalse(nsContentUtils::IsSafeToRunScript()), TrueOrFalse(sInstalledMenuKeyboardListener), BrowserParent::GetFocused(), ToString(sActiveChildInputContext).c_str(), sFocusedPresContext.get(), sFocusedElement.get(), sPseudoFocusChangeRunnable.get())); TrueOrFalse(sInstalledMenuKeyboardListener), static_cast<void*>(BrowserParent::GetFocused()), ToString(sActiveChildInputContext).c_str(), static_cast<void*>(sFocusedPresContext), sFocusedElement, static_cast<void*>(sPseudoFocusChangeRunnable)); // Update the state whether the menubar has pseudo focus or not immediately. // This will be referred by the runner which is created below. Loading editor/libeditor/EditorLineBreak.h +16 −14 Original line number Diff line number Diff line Loading @@ -34,15 +34,15 @@ enum class PaddingForEmptyBlock { Significant, }; inline std::ostream& operator<<(std::ostream& aStream, const PaddingForEmptyBlock& aValue) { return aStream << (aValue == PaddingForEmptyBlock::Significant inline std::string format_as(const PaddingForEmptyBlock& aValue) { return aValue == PaddingForEmptyBlock::Significant ? "PaddingForEmptyBlock::Significant" : "PaddingForEmptyBlock::Unnecessary"); : "PaddingForEmptyBlock::Unnecessary"; } inline auto format_as(const PaddingForEmptyBlock& aValue) { return ToString(aValue); inline std::ostream& operator<<(std::ostream& aStream, const PaddingForEmptyBlock& aValue) { return aStream << format_as(aValue); } /****************************************************************************** Loading Loading @@ -289,13 +289,11 @@ class EditorLineBreakBase { friend inline std::ostream& operator<<( std::ostream& aStream, const EditorLineBreakBase& aLineBreak) { return aStream << "{ mContent=" << ToString(nsCOMPtr<nsIContent>(aLineBreak.mContent)) << ", mOffsetInText=" << aLineBreak.mOffsetInText << " }"; } auto format_as(const EditorLineBreakBase& aLineBreak) { return ToString(aLineBreak); return aStream << fmt::format("{{ mContent={}, mOffsetInText={} }}", nsCOMPtr<nsIContent>(aLineBreak.mContent), // XXX Oddly, cannot make Maybe<uint32> // formattable. Maybe a bug of {fmt}. ToString(aLineBreak.mOffsetInText)); } private: Loading Loading @@ -478,4 +476,8 @@ class CreateLineBreakResult final : public CaretPoint { } // namespace mozilla template <typename CT> struct fmt::formatter<mozilla::EditorLineBreakBase<CT>> : fmt::ostream_formatter {}; #endif // #ifndef EditorLineBreak_h editor/libeditor/WSRunScanner.h +1 −1 Original line number Diff line number Diff line Loading @@ -659,7 +659,7 @@ class MOZ_STACK_CLASS WSScanResult final { } return aStream << ", mContent: " << aResult.mContent << ", mEditingHost: " << aResult.mEditingHost << "< mIgnoredLineBreak: " << aResult.mIgnoredLineBreak << ", mIgnoredLineBreak: " << aResult.mIgnoredLineBreak << ", mOffset: " << aResult.mOffset << ", mDirection: " << aResult.mDirection << " }"; } Loading mfbt/DbgMacro.h +8 −6 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ #include "mozilla/MacroForEach.h" #include "mozilla/Span.h" #include <fmt/format.h> #include <cstdio> #include <sstream> Loading Loading @@ -43,12 +44,13 @@ struct supports_os<T, std::void_t<decltype(std::declval<std::ostream&>() // be dereferenced (in which cases we just write the pointer value). template <typename T> std::ostream& DebugValue(std::ostream& aOut, T* aValue) { if constexpr (detail::supports_os<T>::value) { if (aValue) { return aOut << *aValue << " @ " << aValue; } else { if (!aValue) { return aOut << "null"; } if constexpr (fmt::is_formattable<T>::value) { return aOut << fmt::format("{}", *aValue) << " @ " << aValue; } else if constexpr (detail::supports_os<T>::value) { return aOut << *aValue << " @ " << aValue; } else { return aOut << aValue; } Loading Loading
dom/base/Selection.cpp +6 −8 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ static void LogSelectionAPI(const dom::Selection* aSelection, const nsINode* aNode) { MOZ_LOG_FMT(sSelectionAPILog, LogLevel::Info, "{} Selection::{}({}={})", static_cast<const void*>(aSelection), aFuncName, aArgName, ToString(RefPtr{aNode})); RefPtr{aNode}); } static void LogSelectionAPI(const dom::Selection* aSelection, Loading @@ -177,7 +177,7 @@ static void LogSelectionAPI(const dom::Selection* aSelection, MOZ_LOG_FMT(sSelectionAPILog, LogLevel::Info, "{} Selection::{}({}={}, {}={})", static_cast<const void*>(aSelection), aFuncName, aArgName1, ToString(RefPtr{aNode}), aArgName2, aOffset); RefPtr{aNode}, aArgName2, aOffset); } static void LogSelectionAPI(const dom::Selection* aSelection, Loading Loading @@ -3155,12 +3155,10 @@ void Selection::ExtendInternal(nsINode& aContainer, uint32_t aOffset, if (aContainer.GetFrameSelection() != mFrameSelection) { NS_ASSERTION( false, nsFmtCString( "mFrameSelection is {} which is expected as " fmt::format("mFrameSelection is {} which is expected as " "aContainer.GetFrameSelection() ({})", mozilla::ToString(mFrameSelection).c_str(), mozilla::ToString(RefPtr{aContainer.GetFrameSelection()}).c_str()) .get()); mFrameSelection, RefPtr{aContainer.GetFrameSelection()}) .c_str()); aRv.Throw(NS_ERROR_FAILURE); return; } Loading
dom/events/IMEStateManager.cpp +37 −37 Original line number Diff line number Diff line Loading @@ -661,33 +661,29 @@ nsresult IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, sFocusedElement.get() == aElement && aAction.mFocusChange != InputContextAction::MENU_GOT_PSEUDO_FOCUS; MOZ_LOG( MOZ_LOG_FMT( sISMLog, LogLevel::Info, ("OnChangeFocusInternal(aPresContext=0x%p (available: %s), " "aElement=0x%p (remote: %s), aAction={ mCause=%s, " "mFocusChange=%s }), sFocusedPresContext=0x%p (available: %s), " "sFocusedElement=0x%p, sTextInputHandlingWidget=0x%p (available: %s), " "BrowserParent::GetFocused()=0x%p, sActiveIMEContentObserver=0x%p, " "sInstalledMenuKeyboardListener=%s, sIsActive=%s, " "restoringContextForRemoteContent=%s", aPresContext, TrueOrFalse(CanHandleWith(aPresContext)), aElement, TrueOrFalse(remoteHasFocus), ToString(aAction.mCause).c_str(), ToString(aAction.mFocusChange).c_str(), sFocusedPresContext.get(), TrueOrFalse(CanHandleWith(sFocusedPresContext)), sFocusedElement.get(), sTextInputHandlingWidget, "OnChangeFocusInternal(\naPresContext={} (available: {}),\n" "aElement={} (remote: {}),\n" "aAction={{ mCause={}, mFocusChange={} }}),\n" "sFocusedPresContext={} (available: {}),\n" "sFocusedElement={},\n" "sTextInputHandlingWidget={} (available: {}), " "BrowserParent::GetFocused()={}, sActiveIMEContentObserver={}, " "sInstalledMenuKeyboardListener={}, sIsActive={}, " "restoringContextForRemoteContent={}", static_cast<void*>(aPresContext), TrueOrFalse(CanHandleWith(aPresContext)), RefPtr{aElement}, TrueOrFalse(remoteHasFocus), ToString(aAction.mCause), ToString(aAction.mFocusChange), static_cast<void*>(sFocusedPresContext), TrueOrFalse(CanHandleWith(sFocusedPresContext)), sFocusedElement, static_cast<void*>(sTextInputHandlingWidget), TrueOrFalse(sTextInputHandlingWidget && !sTextInputHandlingWidget->Destroyed()), BrowserParent::GetFocused(), sActiveIMEContentObserver.get(), static_cast<void*>(BrowserParent::GetFocused()), static_cast<void*>(sActiveIMEContentObserver), TrueOrFalse(sInstalledMenuKeyboardListener), TrueOrFalse(sIsActive), TrueOrFalse(restoringContextForRemoteContent))); if (aElement) { MOZ_LOG(sISMLog, LogLevel::Debug, (" aElement: %s", ToString(*aElement).c_str())); } if (sFocusedElement) { MOZ_LOG(sISMLog, LogLevel::Debug, (" sFocusedElement: %s", ToString(*sFocusedElement).c_str())); } TrueOrFalse(restoringContextForRemoteContent)); sIsActive = !!aPresContext; if (sPendingFocusedBrowserSwitchingData.isSome()) { Loading Loading @@ -946,18 +942,22 @@ nsresult IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, // static void IMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling) { MOZ_LOG( MOZ_LOG_FMT( sISMLog, LogLevel::Info, ("OnInstalledMenuKeyboardListener(aInstalling=%s), " "nsContentUtils::IsSafeToRunScript()=%s, " "sInstalledMenuKeyboardListener=%s, BrowserParent::GetFocused()=0x%p, " "sActiveChildInputContext=%s, sFocusedPresContext=0x%p, " "sFocusedElement=0x%p, sPseudoFocusChangeRunnable=0x%p", "OnInstalledMenuKeyboardListener(aInstalling={}), " "nsContentUtils::IsSafeToRunScript()={}, " "sInstalledMenuKeyboardListener={}, BrowserParent::GetFocused()={}, " "sActiveChildInputContext={},\n" "sFocusedPresContext={},\n" "sFocusedElement={},\n" "sPseudoFocusChangeRunnable={}", TrueOrFalse(aInstalling), TrueOrFalse(nsContentUtils::IsSafeToRunScript()), TrueOrFalse(sInstalledMenuKeyboardListener), BrowserParent::GetFocused(), ToString(sActiveChildInputContext).c_str(), sFocusedPresContext.get(), sFocusedElement.get(), sPseudoFocusChangeRunnable.get())); TrueOrFalse(sInstalledMenuKeyboardListener), static_cast<void*>(BrowserParent::GetFocused()), ToString(sActiveChildInputContext).c_str(), static_cast<void*>(sFocusedPresContext), sFocusedElement, static_cast<void*>(sPseudoFocusChangeRunnable)); // Update the state whether the menubar has pseudo focus or not immediately. // This will be referred by the runner which is created below. Loading
editor/libeditor/EditorLineBreak.h +16 −14 Original line number Diff line number Diff line Loading @@ -34,15 +34,15 @@ enum class PaddingForEmptyBlock { Significant, }; inline std::ostream& operator<<(std::ostream& aStream, const PaddingForEmptyBlock& aValue) { return aStream << (aValue == PaddingForEmptyBlock::Significant inline std::string format_as(const PaddingForEmptyBlock& aValue) { return aValue == PaddingForEmptyBlock::Significant ? "PaddingForEmptyBlock::Significant" : "PaddingForEmptyBlock::Unnecessary"); : "PaddingForEmptyBlock::Unnecessary"; } inline auto format_as(const PaddingForEmptyBlock& aValue) { return ToString(aValue); inline std::ostream& operator<<(std::ostream& aStream, const PaddingForEmptyBlock& aValue) { return aStream << format_as(aValue); } /****************************************************************************** Loading Loading @@ -289,13 +289,11 @@ class EditorLineBreakBase { friend inline std::ostream& operator<<( std::ostream& aStream, const EditorLineBreakBase& aLineBreak) { return aStream << "{ mContent=" << ToString(nsCOMPtr<nsIContent>(aLineBreak.mContent)) << ", mOffsetInText=" << aLineBreak.mOffsetInText << " }"; } auto format_as(const EditorLineBreakBase& aLineBreak) { return ToString(aLineBreak); return aStream << fmt::format("{{ mContent={}, mOffsetInText={} }}", nsCOMPtr<nsIContent>(aLineBreak.mContent), // XXX Oddly, cannot make Maybe<uint32> // formattable. Maybe a bug of {fmt}. ToString(aLineBreak.mOffsetInText)); } private: Loading Loading @@ -478,4 +476,8 @@ class CreateLineBreakResult final : public CaretPoint { } // namespace mozilla template <typename CT> struct fmt::formatter<mozilla::EditorLineBreakBase<CT>> : fmt::ostream_formatter {}; #endif // #ifndef EditorLineBreak_h
editor/libeditor/WSRunScanner.h +1 −1 Original line number Diff line number Diff line Loading @@ -659,7 +659,7 @@ class MOZ_STACK_CLASS WSScanResult final { } return aStream << ", mContent: " << aResult.mContent << ", mEditingHost: " << aResult.mEditingHost << "< mIgnoredLineBreak: " << aResult.mIgnoredLineBreak << ", mIgnoredLineBreak: " << aResult.mIgnoredLineBreak << ", mOffset: " << aResult.mOffset << ", mDirection: " << aResult.mDirection << " }"; } Loading
mfbt/DbgMacro.h +8 −6 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ #include "mozilla/MacroForEach.h" #include "mozilla/Span.h" #include <fmt/format.h> #include <cstdio> #include <sstream> Loading Loading @@ -43,12 +44,13 @@ struct supports_os<T, std::void_t<decltype(std::declval<std::ostream&>() // be dereferenced (in which cases we just write the pointer value). template <typename T> std::ostream& DebugValue(std::ostream& aOut, T* aValue) { if constexpr (detail::supports_os<T>::value) { if (aValue) { return aOut << *aValue << " @ " << aValue; } else { if (!aValue) { return aOut << "null"; } if constexpr (fmt::is_formattable<T>::value) { return aOut << fmt::format("{}", *aValue) << " @ " << aValue; } else if constexpr (detail::supports_os<T>::value) { return aOut << *aValue << " @ " << aValue; } else { return aOut << aValue; } Loading