Commit dc6d1193 authored by Lando's avatar Lando Committed by asilaghi@mozilla.com
Browse files

Merge autoland to mozilla-central

parents 3bbb4eeb db95648c
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -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,
@@ -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,
@@ -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;
  }
+37 −37
Original line number Diff line number Diff line
@@ -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()) {
@@ -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.
+16 −14
Original line number Diff line number Diff line
@@ -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);
}

/******************************************************************************
@@ -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:
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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 << " }";
  }
+8 −6
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include "mozilla/MacroForEach.h"
#include "mozilla/Span.h"

#include <fmt/format.h>
#include <cstdio>
#include <sstream>

@@ -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