<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>286549</bug_id>
          
          <creation_ts>2025-01-26 01:53:09 -0800</creation_ts>
          <short_desc>[UnifiedPDF] Incremental PDF Loading should be used on iOS family</short_desc>
          <delta_ts>2025-12-04 19:26:57 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>PDF</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>286569</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Abrar Rahman Protyasha">a_protyasha</reporter>
          <assigned_to name="Abrar Rahman Protyasha">a_protyasha</assigned_to>
          <cc>a_protyasha</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2089816</commentid>
    <comment_count>0</comment_count>
    <who name="Abrar Rahman Protyasha">a_protyasha</who>
    <bug_when>2025-01-26 01:53:09 -0800</bug_when>
    <thetext>Currently, with UnifiedPDF enabled, we do not use incremental PDF loading on iOS family. This is because said loading path is gated behind HAVE(INCREMENTAL_PDF_APIS) platform availability. However, all of the following SPI (which the platform availability macro guards against) are available on the iOS family platforms.

```
// CoreGraphics

extern const off_t kCGDataProviderIndeterminateSize;
extern const CFStringRef kCGDataProviderHasHighLatency;

typedef void (*CGDataProviderGetByteRangesCallback)(void *info,
    CFMutableArrayRef buffers, const CFRange *ranges, size_t count);

struct CGDataProviderDirectAccessRangesCallbacks {
    unsigned version;
    CGDataProviderGetBytesAtPositionCallback getBytesAtPosition;
    CGDataProviderGetByteRangesCallback getBytesInRanges;
    CGDataProviderReleaseInfoCallback releaseInfo;
};
typedef struct CGDataProviderDirectAccessRangesCallbacks CGDataProviderDirectAccessRangesCallbacks;

extern void CGDataProviderSetProperty(CGDataProviderRef, CFStringRef key, CFTypeRef value);
extern CGDataProviderRef CGDataProviderCreateMultiRangeDirectAccess(
    void *info, off_t size,
    const CGDataProviderDirectAccessRangesCallbacks *);
```

```
// PDFKit

@interface PDFDocument ()
-(instancetype)initWithProvider:(CGDataProviderRef)dataProvider;
-(void)preloadDataOfPagesInRange:(NSRange)range onQueue:(dispatch_queue_t)queue completion:(void (^)(NSIndexSet* loadedPageIndexes))completionBlock;
-(void)resetFormFields:(PDFActionResetForm *) action;
@property (readwrite, nonatomic) BOOL hasHighLatencyDataProvider;
@end
```

As such, we should try flipping incremental PDF loading for that platform family.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2089817</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-01-26 01:53:18 -0800</bug_when>
    <thetext>&lt;rdar://problem/143648895&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2163454</commentid>
    <comment_count>2</comment_count>
    <who name="Abrar Rahman Protyasha">a_protyasha</who>
    <bug_when>2025-12-04 19:26:57 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/54893</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>