Bug 1409025 - Fix build with FocusState.cpp logging enabled. r?botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 16 Oct 2017 10:35:03 -0400
changeset 680895 4fb37248c65361785f8a6c90466db15e816d803c
parent 680782 c6a2643362a67cdf7a87ac165454fce4b383debb
child 736003 97f2e556efaf1d53e7c46e81ca14b0ab59c089dc
push id84666
push userkgupta@mozilla.com
push dateMon, 16 Oct 2017 14:35:23 +0000
reviewersbotond
bugs1409025
milestone58.0a1
Bug 1409025 - Fix build with FocusState.cpp logging enabled. r?botond MozReview-Commit-ID: 4n3tqnPkPPa
gfx/layers/apz/src/FocusState.cpp
gfx/layers/apz/src/FocusTarget.cpp
gfx/layers/apz/src/FocusTarget.h
--- a/gfx/layers/apz/src/FocusState.cpp
+++ b/gfx/layers/apz/src/FocusState.cpp
@@ -38,20 +38,20 @@ FocusState::ReceiveFocusChangingEvent()
   mLastAPZProcessedEvent += 1;
 }
 
 void
 FocusState::Update(uint64_t aRootLayerTreeId,
                    uint64_t aOriginatingLayersId,
                    const FocusTarget& aState)
 {
-  FS_LOG("Update with rlt=%" PRIu64 ", olt=%" PRIu64 ", ft=(%d, %" PRIu64 ")\n",
+  FS_LOG("Update with rlt=%" PRIu64 ", olt=%" PRIu64 ", ft=(%s, %" PRIu64 ")\n",
          aRootLayerTreeId,
          aOriginatingLayersId,
-         static_cast<int>(aState.mType),
+         aState.Type(),
          aState.mSequenceNumber);
 
   // Update the focus tree with the latest target
   mFocusTree[aOriginatingLayersId] = aState;
 
   // Reset our internal state so we can recalculate it
   mFocusHasKeyEventListeners = false;
   mFocusLayersId = aRootLayerTreeId;
--- a/gfx/layers/apz/src/FocusTarget.cpp
+++ b/gfx/layers/apz/src/FocusTarget.cpp
@@ -225,10 +225,25 @@ FocusTarget::FocusTarget(nsIPresShell* a
 bool
 FocusTarget::operator==(const FocusTarget& aRhs) const
 {
   return mSequenceNumber == aRhs.mSequenceNumber &&
          mFocusHasKeyEventListeners == aRhs.mFocusHasKeyEventListeners &&
          mData == aRhs.mData;
 }
 
+const char*
+FocusTarget::Type() const
+{
+  if (mData.is<RefLayerId>()) {
+    return "RefLayerId";
+  }
+  if (mData.is<ScrollTargets>()) {
+    return "ScrollTargets";
+  }
+  if (mData.is<NoFocusTarget>()) {
+    return "NoFocusTarget";
+  }
+  return "<unknown>";
+}
+
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/apz/src/FocusTarget.h
+++ b/gfx/layers/apz/src/FocusTarget.h
@@ -54,16 +54,18 @@ public:
   /**
    * Construct a focus target for the specified top level PresShell
    */
   FocusTarget(nsIPresShell* aRootPresShell,
               uint64_t aFocusSequenceNumber);
 
   bool operator==(const FocusTarget& aRhs) const;
 
+  const char* Type() const;
+
 public:
   // The content sequence number recorded at the time of this class's creation
   uint64_t mSequenceNumber;
 
   // Whether there are keydown, keypress, or keyup event listeners
   // in the event target chain of the focused element
   bool mFocusHasKeyEventListeners;