Bug 1409025 - Fix build with FocusState.cpp logging enabled. r?botond
MozReview-Commit-ID: 4n3tqnPkPPa
--- 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;