Title: [246327] trunk/Source
Revision
246327
Author
[email protected]
Date
2019-06-11 12:02:31 -0700 (Tue, 11 Jun 2019)

Log Message

Add logging for UI-side compositing hit-testing
https://bugs.webkit.org/show_bug.cgi?id=198739

Reviewed by Antti Koivisto.

Source/WebCore:

Export the TextStream output operator.

* platform/TouchAction.h:

Source/WebKit:

Make it easier to debug UI-side compositing hit-testing issues with a UIHitTesting log
channel, which logs information about the UIView hierarchy, which views are found by
hit-testing, and what touch-actions apply.

This log channel can be set by passing the argument '-WebKit2Logging "UIHitTesting"' when
launching a debug iOS MobileSafari instance.

* Platform/Logging.h:
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(-[UIView _web_findDescendantViewAtPoint:withEvent:]):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView hitTest:withEvent:]):
(-[WKContentView _handleTouchActionsForTouchEvent:]):

Source/WTF:

Make it possible to output an Objective-C object to TextStream, which will
log its -description.

Also add a template for OptionSet<> printing.

* WTF.xcodeproj/project.pbxproj:
* wtf/text/TextStream.h:
(WTF::operator<<):
* wtf/text/cocoa/TextStreamCocoa.mm: Added.
(WTF::TextStream::operator<<):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (246326 => 246327)


--- trunk/Source/WTF/ChangeLog	2019-06-11 18:44:53 UTC (rev 246326)
+++ trunk/Source/WTF/ChangeLog	2019-06-11 19:02:31 UTC (rev 246327)
@@ -1,3 +1,21 @@
+2019-06-10  Simon Fraser  <[email protected]>
+
+        Add logging for UI-side compositing hit-testing
+        https://bugs.webkit.org/show_bug.cgi?id=198739
+
+        Reviewed by Antti Koivisto.
+
+        Make it possible to output an Objective-C object to TextStream, which will
+        log its -description.
+
+        Also add a template for OptionSet<> printing.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/text/TextStream.h:
+        (WTF::operator<<):
+        * wtf/text/cocoa/TextStreamCocoa.mm: Added.
+        (WTF::TextStream::operator<<):
+
 2019-06-11  Saam Barati  <[email protected]>
 
         Roll out PAC cage

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (246326 => 246327)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2019-06-11 18:44:53 UTC (rev 246326)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2019-06-11 19:02:31 UTC (rev 246327)
@@ -23,6 +23,7 @@
 /* Begin PBXBuildFile section */
 		0F30BA901E78708E002CA847 /* GlobalVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F30BA8A1E78708E002CA847 /* GlobalVersion.cpp */; };
 		0F30CB5A1FCDF134004B5323 /* ConcurrentPtrHashSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F30CB581FCDF133004B5323 /* ConcurrentPtrHashSet.cpp */; };
+		0F3492D722AF431C004F85FC /* TextStreamCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F3492D622AF42F1004F85FC /* TextStreamCocoa.mm */; };
 		0F43D8F11DB5ADDC00108FB6 /* AutomaticThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F43D8EF1DB5ADDC00108FB6 /* AutomaticThread.cpp */; };
 		0F5BF1761F23D49A0029D91D /* Gigacage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F5BF1741F23D49A0029D91D /* Gigacage.cpp */; };
 		0F60F32F1DFCBD1B00416D6C /* LockedPrintStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F60F32D1DFCBD1B00416D6C /* LockedPrintStream.cpp */; };
@@ -202,6 +203,7 @@
 		0F30CB581FCDF133004B5323 /* ConcurrentPtrHashSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConcurrentPtrHashSet.cpp; sourceTree = "<group>"; };
 		0F30CB591FCDF133004B5323 /* ConcurrentPtrHashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConcurrentPtrHashSet.h; sourceTree = "<group>"; };
 		0F31DD701F1308BC0072EB4A /* LockAlgorithmInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LockAlgorithmInlines.h; sourceTree = "<group>"; };
+		0F3492D622AF42F1004F85FC /* TextStreamCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TextStreamCocoa.mm; sourceTree = "<group>"; };
 		0F3501631BB258C800F0A2A3 /* WeakRandom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakRandom.h; sourceTree = "<group>"; };
 		0F43D8EF1DB5ADDC00108FB6 /* AutomaticThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutomaticThread.cpp; sourceTree = "<group>"; };
 		0F43D8F01DB5ADDC00108FB6 /* AutomaticThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutomaticThread.h; sourceTree = "<group>"; };
@@ -831,6 +833,7 @@
 				A5BA15F41824348000A82E69 /* StringImplCocoa.mm */,
 				93934BD218A1E8C300D0D6A1 /* StringViewCocoa.mm */,
 				1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */,
+				0F3492D622AF42F1004F85FC /* TextStreamCocoa.mm */,
 			);
 			path = cocoa;
 			sourceTree = "<group>";
@@ -1620,6 +1623,7 @@
 				1C181C7F1D3078DA00F5FA16 /* TextBreakIterator.cpp in Sources */,
 				1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp in Sources */,
 				A3E4DD931F3A803400DED0B4 /* TextStream.cpp in Sources */,
+				0F3492D722AF431C004F85FC /* TextStreamCocoa.mm in Sources */,
 				E311FB171F0A568B003C08DE /* ThreadGroup.cpp in Sources */,
 				A8A4744A151A825B004123FF /* Threading.cpp in Sources */,
 				A32D8FA521FFFAB400780662 /* ThreadingPOSIX.cpp in Sources */,

Modified: trunk/Source/WTF/wtf/text/TextStream.h (246326 => 246327)


--- trunk/Source/WTF/wtf/text/TextStream.h	2019-06-11 18:44:53 UTC (rev 246326)
+++ trunk/Source/WTF/wtf/text/TextStream.h	2019-06-11 19:02:31 UTC (rev 246327)
@@ -70,6 +70,10 @@
     // Deprecated. Use the NumberRespectingIntegers FormattingFlag instead.
     WTF_EXPORT_PRIVATE TextStream& operator<<(const FormatNumberRespectingIntegers&);
 
+#ifdef __OBJC__
+    WTF_EXPORT_PRIVATE TextStream& operator<<(id<NSObject>);
+#endif
+
     FormattingFlags formattingFlags() const { return m_formattingFlags; }
     void setFormattingFlags(FormattingFlags flags) { m_formattingFlags = flags; }
 
@@ -180,6 +184,20 @@
     return ts << "]";
 }
 
+template<typename Option>
+TextStream& operator<<(TextStream& ts, const OptionSet<Option>& options)
+{
+    ts << "[";
+    bool needComma = false;
+    for (auto option : options) {
+        if (needComma)
+            ts << ", ";
+        needComma = true;
+        ts << option;
+    }
+    return ts << "]";
+}
+
 // Deprecated. Use TextStream::writeIndent() instead.
 WTF_EXPORT_PRIVATE void writeIndent(TextStream&, int indent);
 

Added: trunk/Source/WTF/wtf/text/cocoa/TextStreamCocoa.mm (0 => 246327)


--- trunk/Source/WTF/wtf/text/cocoa/TextStreamCocoa.mm	                        (rev 0)
+++ trunk/Source/WTF/wtf/text/cocoa/TextStreamCocoa.mm	2019-06-11 19:02:31 UTC (rev 246327)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include <wtf/text/TextStream.h>
+
+namespace WTF {
+
+TextStream& TextStream::operator<<(id<NSObject> object)
+{
+    m_text.append([object description]);
+    return *this;
+}
+
+}

Modified: trunk/Source/WebCore/ChangeLog (246326 => 246327)


--- trunk/Source/WebCore/ChangeLog	2019-06-11 18:44:53 UTC (rev 246326)
+++ trunk/Source/WebCore/ChangeLog	2019-06-11 19:02:31 UTC (rev 246327)
@@ -1,3 +1,14 @@
+2019-06-10  Simon Fraser  <[email protected]>
+
+        Add logging for UI-side compositing hit-testing
+        https://bugs.webkit.org/show_bug.cgi?id=198739
+
+        Reviewed by Antti Koivisto.
+
+        Export the TextStream output operator.
+
+        * platform/TouchAction.h:
+
 2019-06-11  Greg Doolittle  <[email protected]>
 
         Web Inspector: AXI: Audit: image label test is throwing spurious errors on elements with existing alt attr, but no value: <img alt>

Modified: trunk/Source/WebCore/platform/TouchAction.h (246326 => 246327)


--- trunk/Source/WebCore/platform/TouchAction.h	2019-06-11 18:44:53 UTC (rev 246326)
+++ trunk/Source/WebCore/platform/TouchAction.h	2019-06-11 19:02:31 UTC (rev 246327)
@@ -40,7 +40,7 @@
     PinchZoom    = 1 << 5,
 };
 
-TextStream& operator<<(TextStream&, TouchAction);
+WEBCORE_EXPORT TextStream& operator<<(TextStream&, TouchAction);
 
 }
 

Modified: trunk/Source/WebKit/ChangeLog (246326 => 246327)


--- trunk/Source/WebKit/ChangeLog	2019-06-11 18:44:53 UTC (rev 246326)
+++ trunk/Source/WebKit/ChangeLog	2019-06-11 19:02:31 UTC (rev 246327)
@@ -1,3 +1,24 @@
+2019-06-10  Simon Fraser  <[email protected]>
+
+        Add logging for UI-side compositing hit-testing
+        https://bugs.webkit.org/show_bug.cgi?id=198739
+
+        Reviewed by Antti Koivisto.
+
+        Make it easier to debug UI-side compositing hit-testing issues with a UIHitTesting log
+        channel, which logs information about the UIView hierarchy, which views are found by
+        hit-testing, and what touch-actions apply.
+
+        This log channel can be set by passing the argument '-WebKit2Logging "UIHitTesting"' when
+        launching a debug iOS MobileSafari instance.
+
+        * Platform/Logging.h:
+        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
+        (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView hitTest:withEvent:]):
+        (-[WKContentView _handleTouchActionsForTouchEvent:]):
+
 2019-06-11  Antti Koivisto  <[email protected]>
 
         REGRESSION (iOS): Can't scroll litter-robot.com checkout form's dropdown menus

Modified: trunk/Source/WebKit/Platform/Logging.h (246326 => 246327)


--- trunk/Source/WebKit/Platform/Logging.h	2019-06-11 18:44:53 UTC (rev 246326)
+++ trunk/Source/WebKit/Platform/Logging.h	2019-06-11 19:02:31 UTC (rev 246327)
@@ -84,6 +84,7 @@
     M(SessionState) \
     M(StorageAPI) \
     M(TextInput) \
+    M(UIHitTesting) \
     M(ViewGestures) \
     M(ViewState) \
     M(ViewportSizing) \

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm (246326 => 246327)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm	2019-06-11 18:44:53 UTC (rev 246326)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm	2019-06-11 19:02:31 UTC (rev 246327)
@@ -28,6 +28,7 @@
 
 #if PLATFORM(IOS_FAMILY)
 
+#import "Logging.h"
 #import "RemoteLayerTreeHost.h"
 #import "RemoteLayerTreeNode.h"
 #import "UIKitSPI.h"
@@ -136,17 +137,26 @@
     Vector<UIView *, 16> viewsAtPoint;
     WebKit::collectDescendantViewsAtPoint(viewsAtPoint, self, point, event);
 
+    LOG_WITH_STREAM(UIHitTesting, stream << (void*)self << "_web_findDescendantViewAtPoint " << WebCore::FloatPoint(point) << " found " << viewsAtPoint.size() << " views");
+
     for (auto *view : WTF::makeReversedRange(viewsAtPoint)) {
         if ([view conformsToProtocol:@protocol(WKNativelyInteractible)]) {
+            LOG_WITH_STREAM(UIHitTesting, stream << " " << (void*)view << " is natively interactible");
             CGPoint subviewPoint = [view convertPoint:point fromView:self];
             return [view hitTest:subviewPoint withEvent:event];
         }
 
         if ([view isKindOfClass:[WKChildScrollView class]]) {
-            if (WebKit::isScrolledBy((WKChildScrollView *)view, viewsAtPoint.last()))
+            if (WebKit::isScrolledBy((WKChildScrollView *)view, viewsAtPoint.last())) {
+                LOG_WITH_STREAM(UIHitTesting, stream << " " << (void*)view << " is child scroll view and scrolled by " << (void*)viewsAtPoint.last());
                 return view;
+            }
         }
+
+        LOG_WITH_STREAM(UIHitTesting, stream << " ignoring " << [view class] << " " << (void*)view);
     }
+
+    LOG_WITH_STREAM(UIHitTesting, stream << (void*)self << "_web_findDescendantViewAtPoint found no interactive views");
     return nil;
 }
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (246326 => 246327)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-06-11 18:44:53 UTC (rev 246326)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-06-11 19:02:31 UTC (rev 246327)
@@ -1077,10 +1077,16 @@
 {
     for (UIView *subView in [_interactionViewsContainerView.get() subviews]) {
         UIView *hitView = [subView hitTest:[subView convertPoint:point fromView:self] withEvent:event];
-        if (hitView)
+        if (hitView) {
+            LOG_WITH_STREAM(UIHitTesting, stream << self << "hitTest at " << WebCore::FloatPoint(point) << " found interaction view " << hitView);
             return hitView;
+        }
     }
-    return [super hitTest:point withEvent:event];
+
+    LOG_WITH_STREAM(UIHitTesting, stream << "hit-testing WKContentView subviews " << [[self recursiveDescription] UTF8String]);
+    UIView* hitView = [super hitTest:point withEvent:event];
+    LOG_WITH_STREAM(UIHitTesting, stream << " found view " << [hitView class] << " " << (void*)hitView);
+    return hitView;
 }
 
 - (const WebKit::InteractionInformationAtPosition&)positionInformation
@@ -1348,8 +1354,10 @@
         auto phase = touchPoint.phase();
         if (phase == WebKit::WebPlatformTouchPoint::TouchPressed) {
             auto touchActions = WebKit::touchActionsForPoint(self, touchPoint.location());
+            LOG_WITH_STREAM(UIHitTesting, stream << "touchActionsForPoint " << touchPoint.location() << " found " << touchActions);
             if (!touchActions || touchActions.containsAny({ WebCore::TouchAction::Auto, WebCore::TouchAction::Manipulation }))
                 continue;
+
             scrollingCoordinator->setTouchActionsForTouchIdentifier(touchActions, touchPoint.identifier());
 
             if (!touchActions.contains(WebCore::TouchAction::PinchZoom))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to