Changeset 272228 in webkit


Ignore:
Timestamp:
Feb 2, 2021 12:57:05 PM (3 years ago)
Author:
achristensen@apple.com
Message:

Adopt UIEventAttribution instead of _UIEventAttribution
https://bugs.webkit.org/show_bug.cgi?id=220683

Reviewed by John Wilander.

Source/WebKit:

UIKit introduced UIEventAttribution, so let's adopt it so they can remove their SPI.
See rdar://73629041

  • UIProcess/API/Cocoa/WKWebViewPrivate.h:
  • UIProcess/API/ios/WKWebViewIOS.mm:

(-[WKWebView _setUIEventAttribution:]):
(-[WKWebView _uiEventAttribution]):

Source/WTF:

  • wtf/PlatformHave.h:

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm:

(-[MockEventAttribution initWithReportEndpoint:destinationURL:]):
(TestWebKitAPI::TEST):
(-[MockEventAttribution initWithReportEndpoint:attributeOn:]): Deleted.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r272195 r272228  
     12021-02-02  Alex Christensen  <achristensen@webkit.org>
     2
     3        Adopt UIEventAttribution instead of _UIEventAttribution
     4        https://bugs.webkit.org/show_bug.cgi?id=220683
     5
     6        Reviewed by John Wilander.
     7
     8        * wtf/PlatformHave.h:
     9
    1102021-02-02  Carlos Garcia Campos  <cgarcia@igalia.com>
    211
  • trunk/Source/WTF/wtf/PlatformHave.h

    r272188 r272228  
    743743#endif
    744744
     745#if ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000)
     746#define HAVE_UI_EVENT_ATTRIBUTION 1
     747#endif
     748
    745749#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000) \
    746750    || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000) \
  • trunk/Source/WebKit/ChangeLog

    r272217 r272228  
     12021-02-02  Alex Christensen  <achristensen@webkit.org>
     2
     3        Adopt UIEventAttribution instead of _UIEventAttribution
     4        https://bugs.webkit.org/show_bug.cgi?id=220683
     5
     6        Reviewed by John Wilander.
     7
     8        UIKit introduced UIEventAttribution, so let's adopt it so they can remove their SPI.
     9        See rdar://73629041
     10
     11        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
     12        * UIProcess/API/ios/WKWebViewIOS.mm:
     13        (-[WKWebView _setUIEventAttribution:]):
     14        (-[WKWebView _uiEventAttribution]):
     15
    1162021-02-02  Rini Patel  <rini_patel@apple.com>
    217
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r272096 r272228  
    109109#endif
    110110
     111@class UIEventAttribution;
    111112@class WKBrowsingContextHandle;
    112113@class WKDownload;
     
    395396
    396397@property (nonatomic, copy, setter=_setEventAttribution:) _UIEventAttribution *_eventAttribution WK_API_AVAILABLE(ios(WK_IOS_TBA));
     398@property (nonatomic, copy, setter=_setUIEventAttribution:) UIEventAttribution *_uiEventAttribution WK_API_AVAILABLE(ios(WK_IOS_TBA));
    397399
    398400@property (nonatomic, readonly) CGRect _contentVisibleRect WK_API_AVAILABLE(ios(10.0));
  • trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm

    r271771 r272228  
    6666#endif
    6767
     68#if HAVE(UI_EVENT_ATTRIBUTION)
     69#import <UIKit/UIEventAttribution.h>
     70#endif
     71
    6872#include "UIKitSoftLink.h"
    6973
     
    25232527@implementation WKWebView (WKPrivateIOS)
    25242528
     2529- (void)_setUIEventAttribution:(UIEventAttribution *)attribution
     2530{
     2531#if HAVE(UI_EVENT_ATTRIBUTION)
     2532    if (attribution) {
     2533        WebCore::PrivateClickMeasurement measurement(
     2534            WebCore::PrivateClickMeasurement::SourceID(attribution.sourceIdentifier),
     2535            WebCore::PrivateClickMeasurement::SourceSite(attribution.reportEndpoint),
     2536            WebCore::PrivateClickMeasurement::AttributeOnSite(attribution.destinationURL),
     2537            attribution.sourceDescription,
     2538            attribution.purchaser
     2539        );
     2540        _page->setPrivateClickMeasurement(WTFMove(measurement));
     2541    } else
     2542        _page->setPrivateClickMeasurement(WTF::nullopt);
     2543#endif
     2544}
     2545
     2546- (UIEventAttribution *)_uiEventAttribution
     2547{
     2548#if HAVE(UI_EVENT_ATTRIBUTION)
     2549    auto& measurement = _page->privateClickMeasurement();
     2550    if (!measurement || !measurement->sourceID().isValid())
     2551        return nil;
     2552
     2553    auto attributeOnURL = URL(URL(), makeString("https://", measurement->attributeOnSite().registrableDomain.string()));
     2554    return [[[UIEventAttribution alloc] initWithSourceIdentifier:measurement->sourceID().id destinationURL:attributeOnURL sourceDescription:measurement->sourceDescription() purchaser:measurement->purchaser()] autorelease];
     2555#else
     2556    return nil;
     2557#endif
     2558}
     2559
    25252560- (void)_setEventAttribution:(_UIEventAttribution *)attribution
    25262561{
  • trunk/Tools/ChangeLog

    r272220 r272228  
     12021-02-02  Alex Christensen  <achristensen@webkit.org>
     2
     3        Adopt UIEventAttribution instead of _UIEventAttribution
     4        https://bugs.webkit.org/show_bug.cgi?id=220683
     5
     6        Reviewed by John Wilander.
     7
     8        * TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm:
     9        (-[MockEventAttribution initWithReportEndpoint:destinationURL:]):
     10        (TestWebKitAPI::TEST):
     11        (-[MockEventAttribution initWithReportEndpoint:attributeOn:]): Deleted.
     12
    1132021-02-02  Aakash Jain  <aakash_jain@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm

    r271799 r272228  
    2626#import "config.h"
    2727
    28 #if PLATFORM(IOS_FAMILY)
     28#if HAVE(UI_EVENT_ATTRIBUTION)
    2929
    3030#import "HTTPServer.h"
     
    3939
    4040@property (nonatomic, assign, readonly) uint8_t sourceIdentifier;
    41 @property (nonatomic, copy, readonly) NSURL *attributeOn;
     41@property (nonatomic, copy, readonly) NSURL *destinationURL;
    4242@property (nonatomic, copy, readonly) NSURL *reportEndpoint;
    4343@property (nonatomic, copy, readonly) NSString *sourceDescription;
    4444@property (nonatomic, copy, readonly) NSString *purchaser;
    45 - (instancetype)initWithReportEndpoint:(NSURL *)reportEndpoint attributeOn:(NSURL *)attributeOn;
     45- (instancetype)initWithReportEndpoint:(NSURL *)reportEndpoint destinationURL:(NSURL *)destinationURL;
    4646
    4747@end
     
    4949@implementation MockEventAttribution
    5050
    51 - (instancetype)initWithReportEndpoint:(NSURL *)reportEndpoint attributeOn:(NSURL *)attributeOn
     51- (instancetype)initWithReportEndpoint:(NSURL *)reportEndpoint destinationURL:(NSURL *)destinationURL
    5252{
    5353    if (!(self = [super init]))
     
    5555
    5656    _sourceIdentifier = 42;
    57     _attributeOn = attributeOn;
     57    _destinationURL = destinationURL;
    5858    _reportEndpoint = reportEndpoint;
    5959    _sourceDescription = @"test source description";
     
    102102
    103103    auto exampleURL = [NSURL URLWithString:@"https://example.com/"];
    104     auto attribution = [[[MockEventAttribution alloc] initWithReportEndpoint:server.request().URL attributeOn:exampleURL] autorelease];
     104    auto attribution = [[[MockEventAttribution alloc] initWithReportEndpoint:server.request().URL destinationURL:exampleURL] autorelease];
    105105    auto webView = [[WKWebView new] autorelease];
    106     webView._eventAttribution = (_UIEventAttribution *)attribution;
     106    webView._uiEventAttribution = (UIEventAttribution *)attribution;
    107107    [webView.configuration.websiteDataStore _setResourceLoadStatisticsEnabled:YES];
    108108    [webView.configuration.websiteDataStore _allowTLSCertificateChain:@[(id)testCertificate().get()] forHost:serverURL.host];
Note: See TracChangeset for help on using the changeset viewer.