Bug 951793 - Add overscroll-behavior to the layer dump. r=kats draft
authorBotond Ballo <botond@mozilla.com>
Wed, 25 Oct 2017 13:21:49 -0400
changeset 700777 268c02cd46624d6d02f4113b92fca8060fb3878c
parent 700776 4379863b1acda7a35452efba888e0cb0c5b69c4d
child 700778 05a6c826d8c16ef9ef3f48406f3febaff439177c
push id89971
push userbballo@mozilla.com
push dateMon, 20 Nov 2017 22:06:14 +0000
reviewerskats
bugs951793
milestone59.0a1
Bug 951793 - Add overscroll-behavior to the layer dump. r=kats MozReview-Commit-ID: 629DKmrbVIi
gfx/layers/LayersLogging.cpp
gfx/layers/LayersLogging.h
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -162,31 +162,65 @@ AppendToString(std::stringstream& aStrea
   }
   if (!e.mVerticalPanRegion.IsEmpty()) {
     AppendToString(aStream, e.mVerticalPanRegion, " VerticalPanRegion=", "");
   }
   aStream << "}" << sfx;
 }
 
 void
+AppendToString(std::stringstream& aStream, OverscrollBehavior aBehavior,
+               const char* pfx, const char* sfx)
+{
+  aStream << pfx;
+  switch (aBehavior) {
+  case OverscrollBehavior::Auto: {
+    aStream << "auto";
+    break;
+  }
+  case OverscrollBehavior::Contain: {
+    aStream << "contain";
+    break;
+  }
+  case OverscrollBehavior::None: {
+    aStream << "none";
+    break;
+  }
+  }
+  aStream << sfx;
+}
+
+void
 AppendToString(std::stringstream& aStream, const ScrollMetadata& m,
                const char* pfx, const char* sfx)
 {
   aStream << pfx;
   AppendToString(aStream, m.GetMetrics(), "{ [metrics=");
   AppendToString(aStream, m.GetBackgroundColor(), "] [color=");
   if (m.GetScrollParentId() != FrameMetrics::NULL_SCROLL_ID) {
     AppendToString(aStream, m.GetScrollParentId(), "] [scrollParent=");
   }
   if (m.HasScrollClip()) {
     AppendToString(aStream, m.ScrollClip().GetClipRect(), "] [clip=");
   }
   if (m.HasMaskLayer()) {
     AppendToString(aStream, m.ScrollClip().GetMaskLayerIndex().value(), "] [mask=");
   }
+  OverscrollBehavior overscrollX = m.GetOverscrollBehavior().mBehaviorX;
+  OverscrollBehavior overscrollY = m.GetOverscrollBehavior().mBehaviorY;
+  if (overscrollX == overscrollY && overscrollX != OverscrollBehavior::Auto) {
+    AppendToString(aStream, overscrollX, "] [overscroll=");
+  } else {
+    if (overscrollX != OverscrollBehavior::Auto) {
+      AppendToString(aStream, overscrollX, "] [overscroll-x=");
+    }
+    if (overscrollY != OverscrollBehavior::Auto) {
+      AppendToString(aStream, overscrollY, "] [overscroll-y=");
+    }
+  }
   aStream << "] }" << sfx;
 }
 
 void
 AppendToString(std::stringstream& aStream, const FrameMetrics& m,
                const char* pfx, const char* sfx, bool detailed)
 {
   aStream << pfx;
--- a/gfx/layers/LayersLogging.h
+++ b/gfx/layers/LayersLogging.h
@@ -163,16 +163,20 @@ AppendToString(std::stringstream& aStrea
   aStream << ", covers=" << r.CoversBounds() << ")" << sfx;
 }
 
 void
 AppendToString(std::stringstream& aStream, const EventRegions& e,
                const char* pfx="", const char* sfx="");
 
 void
+AppendToString(std::stringstream& aStream, OverscrollBehavior aBehavior,
+               const char* pfx="", const char* sfx="");
+
+void
 AppendToString(std::stringstream& aStream, const ScrollMetadata& m,
                const char* pfx="", const char* sfx="");
 
 void
 AppendToString(std::stringstream& aStream, const FrameMetrics& m,
                const char* pfx="", const char* sfx="", bool detailed = false);
 
 void