Bug 216435

Summary: Clean up LazyLoadImageObserver
Product: WebKit Reporter: Rob Buis <rbuis>
Component: ImagesAssignee: Rob Buis <rbuis>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, changseok, darin, esprehn+autocc, ews-watchlist, gyuyoung.kim, kangil.han, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Rob Buis 2020-09-12 07:38:18 PDT
Clean up LazyLoadImageObserver to match LazyLoadFrameObserver, inspired by the review of
bug 215442. Specifically remove the friend declaration and create function, rename
m_lazyLoadImageObserver to make its use more clear and therefore remove the comment about it.
Comment 1 Rob Buis 2020-09-12 07:40:35 PDT
Created attachment 408594 [details]
Patch
Comment 2 Darin Adler 2020-09-12 14:27:03 PDT
Comment on attachment 408594 [details]
Patch

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

> Source/WebCore/html/LazyLoadImageObserver.h:46
> +    RefPtr<IntersectionObserver> m_lazyLoadImageIntersectionObserver;

You made this name longer, but I might have gone the opposite direction. Given that this is the intersection observer in the class LazyLoadImageObserver, obviously it’s the one for lazily loading image, so I would leave the words "lazy", "load", and "image" out of the name. I might even just call it m_observer, given the narrow context of being the only data member of this particular class. A longer name isn’t really helpful to understand what this is for.
Comment 3 Rob Buis 2020-09-13 01:37:17 PDT
Created attachment 408645 [details]
Patch
Comment 4 Rob Buis 2020-09-13 02:41:10 PDT
Comment on attachment 408594 [details]
Patch

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

>> Source/WebCore/html/LazyLoadImageObserver.h:46
>> +    RefPtr<IntersectionObserver> m_lazyLoadImageIntersectionObserver;
> 
> You made this name longer, but I might have gone the opposite direction. Given that this is the intersection observer in the class LazyLoadImageObserver, obviously it’s the one for lazily loading image, so I would leave the words "lazy", "load", and "image" out of the name. I might even just call it m_observer, given the narrow context of being the only data member of this particular class. A longer name isn’t really helpful to understand what this is for.

Interesting. I think you are right, given the class name the member var name was too long and contained duplicate information. Fixed now, also for LazyLoadFrameObserver to be consistent.
Comment 5 EWS 2020-09-13 02:45:12 PDT
Committed r266991: <https://trac.webkit.org/changeset/266991>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 408645 [details].
Comment 6 Radar WebKit Bug Importer 2020-09-13 02:46:17 PDT
<rdar://problem/68795266>