⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246327 in webkit


Ignore:
Timestamp:
Jun 11, 2019, 12:02:31 PM (7 years ago)
Author:
Simon Fraser
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<<):

Location:
trunk/Source
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r246322 r246327  
     12019-06-10  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add logging for UI-side compositing hit-testing
     4        https://bugs.webkit.org/show_bug.cgi?id=198739
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Make it possible to output an Objective-C object to TextStream, which will
     9        log its -description.
     10
     11        Also add a template for OptionSet<> printing.
     12
     13        * WTF.xcodeproj/project.pbxproj:
     14        * wtf/text/TextStream.h:
     15        (WTF::operator<<):
     16        * wtf/text/cocoa/TextStreamCocoa.mm: Added.
     17        (WTF::TextStream::operator<<):
     18
    1192019-06-11  Saam Barati  <sbarati@apple.com>
    220
  • trunk/Source/WTF/WTF.xcodeproj/project.pbxproj

    r246322 r246327  
    2424                0F30BA901E78708E002CA847 /* GlobalVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F30BA8A1E78708E002CA847 /* GlobalVersion.cpp */; };
    2525                0F30CB5A1FCDF134004B5323 /* ConcurrentPtrHashSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F30CB581FCDF133004B5323 /* ConcurrentPtrHashSet.cpp */; };
     26                0F3492D722AF431C004F85FC /* TextStreamCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F3492D622AF42F1004F85FC /* TextStreamCocoa.mm */; };
    2627                0F43D8F11DB5ADDC00108FB6 /* AutomaticThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F43D8EF1DB5ADDC00108FB6 /* AutomaticThread.cpp */; };
    2728                0F5BF1761F23D49A0029D91D /* Gigacage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F5BF1741F23D49A0029D91D /* Gigacage.cpp */; };
     
    203204                0F30CB591FCDF133004B5323 /* ConcurrentPtrHashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConcurrentPtrHashSet.h; sourceTree = "<group>"; };
    204205                0F31DD701F1308BC0072EB4A /* LockAlgorithmInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LockAlgorithmInlines.h; sourceTree = "<group>"; };
     206                0F3492D622AF42F1004F85FC /* TextStreamCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TextStreamCocoa.mm; sourceTree = "<group>"; };
    205207                0F3501631BB258C800F0A2A3 /* WeakRandom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakRandom.h; sourceTree = "<group>"; };
    206208                0F43D8EF1DB5ADDC00108FB6 /* AutomaticThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutomaticThread.cpp; sourceTree = "<group>"; };
     
    832834                                93934BD218A1E8C300D0D6A1 /* StringViewCocoa.mm */,
    833835                                1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */,
     836                                0F3492D622AF42F1004F85FC /* TextStreamCocoa.mm */,
    834837                        );
    835838                        path = cocoa;
     
    16211624                                1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp in Sources */,
    16221625                                A3E4DD931F3A803400DED0B4 /* TextStream.cpp in Sources */,
     1626                                0F3492D722AF431C004F85FC /* TextStreamCocoa.mm in Sources */,
    16231627                                E311FB171F0A568B003C08DE /* ThreadGroup.cpp in Sources */,
    16241628                                A8A4744A151A825B004123FF /* Threading.cpp in Sources */,
  • trunk/Source/WTF/wtf/text/TextStream.h

    r245336 r246327  
    7171    WTF_EXPORT_PRIVATE TextStream& operator<<(const FormatNumberRespectingIntegers&);
    7272
     73#ifdef __OBJC__
     74    WTF_EXPORT_PRIVATE TextStream& operator<<(id<NSObject>);
     75#endif
     76
    7377    FormattingFlags formattingFlags() const { return m_formattingFlags; }
    7478    void setFormattingFlags(FormattingFlags flags) { m_formattingFlags = flags; }
     
    181185}
    182186
     187template<typename Option>
     188TextStream& operator<<(TextStream& ts, const OptionSet<Option>& options)
     189{
     190    ts << "[";
     191    bool needComma = false;
     192    for (auto option : options) {
     193        if (needComma)
     194            ts << ", ";
     195        needComma = true;
     196        ts << option;
     197    }
     198    return ts << "]";
     199}
     200
    183201// Deprecated. Use TextStream::writeIndent() instead.
    184202WTF_EXPORT_PRIVATE void writeIndent(TextStream&, int indent);
  • trunk/Source/WebCore/ChangeLog

    r246320 r246327  
     12019-06-10  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add logging for UI-side compositing hit-testing
     4        https://bugs.webkit.org/show_bug.cgi?id=198739
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Export the TextStream output operator.
     9
     10        * platform/TouchAction.h:
     11
    1122019-06-11  Greg Doolittle  <gr3g@apple.com>
    213
  • trunk/Source/WebCore/platform/TouchAction.h

    r243893 r246327  
    4141};
    4242
    43 TextStream& operator<<(TextStream&, TouchAction);
     43WEBCORE_EXPORT TextStream& operator<<(TextStream&, TouchAction);
    4444
    4545}
  • trunk/Source/WebKit/ChangeLog

    r246316 r246327  
     12019-06-10  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add logging for UI-side compositing hit-testing
     4        https://bugs.webkit.org/show_bug.cgi?id=198739
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Make it easier to debug UI-side compositing hit-testing issues with a UIHitTesting log
     9        channel, which logs information about the UIView hierarchy, which views are found by
     10        hit-testing, and what touch-actions apply.
     11
     12        This log channel can be set by passing the argument '-WebKit2Logging "UIHitTesting"' when
     13        launching a debug iOS MobileSafari instance.
     14
     15        * Platform/Logging.h:
     16        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
     17        (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
     18        * UIProcess/ios/WKContentViewInteraction.mm:
     19        (-[WKContentView hitTest:withEvent:]):
     20        (-[WKContentView _handleTouchActionsForTouchEvent:]):
     21
    1222019-06-11  Antti Koivisto  <antti@apple.com>
    223
  • trunk/Source/WebKit/Platform/Logging.h

    r245320 r246327  
    8585    M(StorageAPI) \
    8686    M(TextInput) \
     87    M(UIHitTesting) \
    8788    M(ViewGestures) \
    8889    M(ViewState) \
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm

    r246316 r246327  
    2929#if PLATFORM(IOS_FAMILY)
    3030
     31#import "Logging.h"
    3132#import "RemoteLayerTreeHost.h"
    3233#import "RemoteLayerTreeNode.h"
     
    137138    WebKit::collectDescendantViewsAtPoint(viewsAtPoint, self, point, event);
    138139
     140    LOG_WITH_STREAM(UIHitTesting, stream << (void*)self << "_web_findDescendantViewAtPoint " << WebCore::FloatPoint(point) << " found " << viewsAtPoint.size() << " views");
     141
    139142    for (auto *view : WTF::makeReversedRange(viewsAtPoint)) {
    140143        if ([view conformsToProtocol:@protocol(WKNativelyInteractible)]) {
     144            LOG_WITH_STREAM(UIHitTesting, stream << " " << (void*)view << " is natively interactible");
    141145            CGPoint subviewPoint = [view convertPoint:point fromView:self];
    142146            return [view hitTest:subviewPoint withEvent:event];
     
    144148
    145149        if ([view isKindOfClass:[WKChildScrollView class]]) {
    146             if (WebKit::isScrolledBy((WKChildScrollView *)view, viewsAtPoint.last()))
     150            if (WebKit::isScrolledBy((WKChildScrollView *)view, viewsAtPoint.last())) {
     151                LOG_WITH_STREAM(UIHitTesting, stream << " " << (void*)view << " is child scroll view and scrolled by " << (void*)viewsAtPoint.last());
    147152                return view;
    148         }
    149     }
     153            }
     154        }
     155
     156        LOG_WITH_STREAM(UIHitTesting, stream << " ignoring " << [view class] << " " << (void*)view);
     157    }
     158
     159    LOG_WITH_STREAM(UIHitTesting, stream << (void*)self << "_web_findDescendantViewAtPoint found no interactive views");
    150160    return nil;
    151161}
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r246311 r246327  
    10781078    for (UIView *subView in [_interactionViewsContainerView.get() subviews]) {
    10791079        UIView *hitView = [subView hitTest:[subView convertPoint:point fromView:self] withEvent:event];
    1080         if (hitView)
     1080        if (hitView) {
     1081            LOG_WITH_STREAM(UIHitTesting, stream << self << "hitTest at " << WebCore::FloatPoint(point) << " found interaction view " << hitView);
    10811082            return hitView;
    1082     }
    1083     return [super hitTest:point withEvent:event];
     1083        }
     1084    }
     1085
     1086    LOG_WITH_STREAM(UIHitTesting, stream << "hit-testing WKContentView subviews " << [[self recursiveDescription] UTF8String]);
     1087    UIView* hitView = [super hitTest:point withEvent:event];
     1088    LOG_WITH_STREAM(UIHitTesting, stream << " found view " << [hitView class] << " " << (void*)hitView);
     1089    return hitView;
    10841090}
    10851091
     
    13491355        if (phase == WebKit::WebPlatformTouchPoint::TouchPressed) {
    13501356            auto touchActions = WebKit::touchActionsForPoint(self, touchPoint.location());
     1357            LOG_WITH_STREAM(UIHitTesting, stream << "touchActionsForPoint " << touchPoint.location() << " found " << touchActions);
    13511358            if (!touchActions || touchActions.containsAny({ WebCore::TouchAction::Auto, WebCore::TouchAction::Manipulation }))
    13521359                continue;
     1360
    13531361            scrollingCoordinator->setTouchActionsForTouchIdentifier(touchActions, touchPoint.identifier());
    13541362
Note: See TracChangeset for help on using the changeset viewer.