Bug 189525

Summary: [IntersectionObserver] Implement rootMargin expansion
Product: WebKit Reporter: Ali Juma <ajuma>
Component: Layout and RenderingAssignee: Ali Juma <ajuma>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, cdumez, commit-queue, dbates, esprehn+autocc, ews-watchlist, kangil.han, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 159475    
Attachments:
Description Flags
Patch
none
Patch for landing none

Description Ali Juma 2018-09-11 14:56:08 PDT
Expand the root intersection rectangle by the observer's rootMargin.
Comment 1 Ali Juma 2018-09-11 14:59:37 PDT
Created attachment 349467 [details]
Patch
Comment 2 Simon Fraser (smfr) 2018-09-11 15:32:33 PDT
Comment on attachment 349467 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=349467&action=review

> Source/WebCore/dom/Document.cpp:7498
> +    localRootBounds.move(-rootMarginFloatBox.left(), -rootMarginFloatBox.top());
> +    localRootBounds.expand(rootMarginFloatBox.left() + rootMarginFloatBox.right(), rootMarginFloatBox.top() + rootMarginFloatBox.bottom());

It feels like there should be a cleaner way to do this.
Comment 3 Ali Juma 2018-09-12 08:26:36 PDT
Created attachment 349548 [details]
Patch for landing
Comment 4 Ali Juma 2018-09-12 08:30:10 PDT
(In reply to Simon Fraser (smfr) from comment #2)
> Comment on attachment 349467 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=349467&action=review
> 
> > Source/WebCore/dom/Document.cpp:7498
> > +    localRootBounds.move(-rootMarginFloatBox.left(), -rootMarginFloatBox.top());
> > +    localRootBounds.expand(rootMarginFloatBox.left() + rootMarginFloatBox.right(), rootMarginFloatBox.top() + rootMarginFloatBox.bottom());
> 
> It feels like there should be a cleaner way to do this.

LayoutRect::expand has an overload that takes a LayoutBoxExtent, so I added a version of FloatRect::expand that takes a FloatBoxExtent.
Comment 5 WebKit Commit Bot 2018-09-12 10:03:22 PDT
Comment on attachment 349548 [details]
Patch for landing

Clearing flags on attachment: 349548

Committed r235943: <https://trac.webkit.org/changeset/235943>
Comment 6 WebKit Commit Bot 2018-09-12 10:03:24 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2018-09-12 10:04:21 PDT
<rdar://problem/44386685>