Add logging support to VisibleContentRectUpdateInfo
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2016 19:13:04 +0000 (19:13 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2016 19:13:04 +0000 (19:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164825

Reviewed by Zalan Bujtas.

Add TextStream output to VisibleContentRectUpdateInfo. Just piping it into a logging
stream does single-line output, so also make a convenience dump() function that will
product multiline output. Result look like:

    (VisibleContentRectUpdateInfo
      (lastLayerTreeTransactionID 54)
      (exposedContentRect (523.44,1258.63) width=676.20 height=901.60)
      (unobscuredContentRect (523.44,1293.41) width=676.20 height=866.82)
      (unobscuredRectInScrollViewCoordinates (0,39.50) width=768 height=984.50)
      (customFixedPositionRect (219.64,935) width=980 height=1225)
      (obscuredInset width=0 height=39.50)
      (scale 1.14)
      (inStableState 0)
      (timestamp 736446.61)
      (verticalVelocity -11.36))

* Shared/VisibleContentRectUpdateInfo.cpp:
(WebKit::VisibleContentRectUpdateInfo::dump):
(WebKit::operator<<):
* Shared/VisibleContentRectUpdateInfo.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208799 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp
Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h
Source/WebKit2/UIProcess/ios/WKContentView.mm

index 5d92238..1d514de 100644 (file)
@@ -1,3 +1,33 @@
+2016-11-16  Simon Fraser  <simon.fraser@apple.com>
+
+        Add logging support to VisibleContentRectUpdateInfo
+        https://bugs.webkit.org/show_bug.cgi?id=164825
+
+        Reviewed by Zalan Bujtas.
+
+        Add TextStream output to VisibleContentRectUpdateInfo. Just piping it into a logging
+        stream does single-line output, so also make a convenience dump() function that will
+        product multiline output. Result look like:
+
+            (VisibleContentRectUpdateInfo
+              (lastLayerTreeTransactionID 54)
+              (exposedContentRect (523.44,1258.63) width=676.20 height=901.60)
+              (unobscuredContentRect (523.44,1293.41) width=676.20 height=866.82)
+              (unobscuredRectInScrollViewCoordinates (0,39.50) width=768 height=984.50)
+              (customFixedPositionRect (219.64,935) width=980 height=1225)
+              (obscuredInset width=0 height=39.50)
+              (scale 1.14)
+              (inStableState 0)
+              (timestamp 736446.61)
+              (verticalVelocity -11.36))
+
+        * Shared/VisibleContentRectUpdateInfo.cpp:
+        (WebKit::VisibleContentRectUpdateInfo::dump):
+        (WebKit::operator<<):
+        * Shared/VisibleContentRectUpdateInfo.h:
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
+
 2016-11-15  Simon Fraser  <simon.fraser@apple.com>
 
         [iOS WK2] Scroll view scrolling and zooming animations can keep running across page loads
index 4b5207a..72c6f8e 100644 (file)
@@ -27,6 +27,9 @@
 #include "VisibleContentRectUpdateInfo.h"
 
 #include "WebCoreArgumentCoders.h"
+#include <WebCore/TextStream.h>
+
+using namespace WebCore;
 
 namespace WebKit {
 
@@ -85,4 +88,43 @@ bool VisibleContentRectUpdateInfo::decode(IPC::Decoder& decoder, VisibleContentR
     return true;
 }
 
+String VisibleContentRectUpdateInfo::dump() const
+{
+    TextStream stream;
+    stream << *this;
+    return stream.release();
+}
+
+TextStream& operator<<(TextStream& ts, const VisibleContentRectUpdateInfo& info)
+{
+    TextStream::GroupScope scope(ts);
+    
+    ts << "VisibleContentRectUpdateInfo";
+
+    ts.dumpProperty("lastLayerTreeTransactionID", info.lastLayerTreeTransactionID());
+
+    ts.dumpProperty("exposedContentRect", info.exposedContentRect());
+    ts.dumpProperty("unobscuredContentRect", info.unobscuredContentRect());
+    ts.dumpProperty("unobscuredRectInScrollViewCoordinates", info.unobscuredRectInScrollViewCoordinates());
+    ts.dumpProperty("customFixedPositionRect", info.customFixedPositionRect());
+    ts.dumpProperty("obscuredInset", info.obscuredInset());
+
+    ts.dumpProperty("scale", info.scale());
+    ts.dumpProperty("inStableState", info.inStableState());
+    if (info.isChangingObscuredInsetsInteractively())
+        ts.dumpProperty("isChangingObscuredInsetsInteractively", info.isChangingObscuredInsetsInteractively());
+    if (info.enclosedInScrollableAncestorView())
+        ts.dumpProperty("enclosedInScrollableAncestorView", info.enclosedInScrollableAncestorView());
+
+    ts.dumpProperty("timestamp", info.timestamp());
+    if (info.horizontalVelocity())
+        ts.dumpProperty("horizontalVelocity", info.horizontalVelocity());
+    if (info.verticalVelocity())
+        ts.dumpProperty("verticalVelocity", info.verticalVelocity());
+    if (info.scaleChangeRate())
+        ts.dumpProperty("scaleChangeRate", info.scaleChangeRate());
+
+    return ts;
+}
+
 } // namespace WebKit
index b6b255a..d7b6e6d 100644 (file)
 #define VisibleContentRectUpdateInfo_h
 
 #include <WebCore/FloatRect.h>
+#include <wtf/text/WTFString.h>
 
 namespace IPC {
 class Decoder;
 class Encoder;
 }
 
+namespace WebCore {
+class TextStream;
+}
+
 namespace WebKit {
 
 class VisibleContentRectUpdateInfo {
@@ -83,6 +88,8 @@ public:
     void encode(IPC::Encoder&) const;
     static bool decode(IPC::Decoder&, VisibleContentRectUpdateInfo&);
 
+    String dump() const;
+
 private:
     WebCore::FloatRect m_exposedContentRect;
     WebCore::FloatRect m_unobscuredContentRect;
@@ -117,6 +124,8 @@ inline bool operator==(const VisibleContentRectUpdateInfo& a, const VisibleConte
         && a.enclosedInScrollableAncestorView() == b.enclosedInScrollableAncestorView();
 }
 
+WebCore::TextStream& operator<<(WebCore::TextStream&, const VisibleContentRectUpdateInfo&);
+
 } // namespace WebKit
 
 #endif // VisibleContentRectUpdateInfo_h
index b61aecd..1ea0e81 100644 (file)
@@ -380,8 +380,6 @@ private:
     RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page->scrollingCoordinatorProxy();
     FloatRect fixedPositionRectForLayout = _page->computeCustomFixedPositionRect(unobscuredRect, _page->customFixedPositionRect(), zoomScale, WebPageProxy::UnobscuredRectConstraint::ConstrainedToDocumentRect, scrollingCoordinator->visualViewportEnabled());
 
-    LOG_WITH_STREAM(VisibleRects, stream << "didUpdateVisibleRect: visibleRect:" << visibleRect << " unobscuredRect:" << unobscuredRect << " fixedPositionRectForLayout:" << fixedPositionRectForLayout << " stable: " << isStableState);
-
     VisibleContentRectUpdateInfo visibleContentRectUpdateInfo(
         visibleRect,
         unobscuredRect,
@@ -399,6 +397,8 @@ private:
         velocityData.scaleChangeRate,
         downcast<RemoteLayerTreeDrawingAreaProxy>(*drawingArea).lastCommittedLayerTreeTransactionID());
 
+    LOG_WITH_STREAM(VisibleRects, stream << "-[WKContentView didUpdateVisibleRect]" << visibleContentRectUpdateInfo.dump());
+
     _page->updateVisibleContentRects(visibleContentRectUpdateInfo);
 
     FloatRect fixedPositionRect = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), _page->customFixedPositionRect(), zoomScale, WebPageProxy::UnobscuredRectConstraint::Unconstrained, scrollingCoordinator->visualViewportEnabled());