Bug 200270

Summary: [FTW] Refactor Direct2D code to follow Cairo's model to support modern WebKit
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebCore Misc.Assignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, commit-queue, dino, don.olmstead, ews-watchlist, Hironori.Fujii, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 10   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 161817    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch for landing none

Description Brent Fulgham 2019-07-30 09:20:07 PDT
Refactor the Direct2D code to separate the core drawing routines into helper functions that can be used by GraphicsContext and GraphicsContextImpl.
Comment 1 Brent Fulgham 2019-07-30 12:34:45 PDT
Created attachment 375169 [details]
Patch
Comment 2 EWS Watchlist 2019-07-30 12:38:26 PDT
Attachment 375169 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp:68:  Should have a space between // and comment  [whitespace/comments] [4]
Total errors found: 1 in 33 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Brent Fulgham 2019-07-30 13:15:16 PDT
Created attachment 375171 [details]
Patch
Comment 4 Dean Jackson 2019-07-30 13:27:31 PDT
Comment on attachment 375171 [details]
Patch

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

rs=me assuming you don't land those settings changes.

> Source/WebCore/page/Settings.yaml:148
> -  initial: false
> +  initial: true
>    onChange: setNeedsRecalcStyleInAllFrames
>  showRepaintCounter:
> -  initial: false
> +  initial: true
>    onChange: setNeedsRecalcStyleInAllFrames
>  visibleDebugOverlayRegions:
>    type: DebugOverlayRegions
>    initial: 0
>  showTiledScrollingIndicator:
> -  initial: false
> +  initial: true

I really think you don't want this!!
Comment 5 Brent Fulgham 2019-07-30 13:32:54 PDT
Created attachment 375172 [details]
Patch
Comment 6 Alex Christensen 2019-07-30 13:41:27 PDT
Comment on attachment 375172 [details]
Patch

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

> Source/WebCore/platform/graphics/win/BackingStoreBackendDirect2D.h:57
> +    void* m_surfaceBackingData;

This needs a default initializer, and maybe it should go in the impl.

> Source/WebCore/platform/graphics/win/BackingStoreBackendDirect2DImpl.cpp:43
> +static COMPtr<IWICBitmap> createDirect2DImageSurfaceWithFastMalloc(const IntSize& size, double deviceScaleFactor, void*& backingStoreData)

I think it would be nicer if this returned a std::pair<COMPtr<IWICBitmap>, void*>

> Source/WebCore/platform/graphics/win/BackingStoreBackendDirect2DImpl.h:47
> +    void* m_scrollSurfaceBackingData;

{ nullptr }

> Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:78
> +    PlatformContextDirect2D* platformContext() { return &m_platformContext; }

Why not just return a PlatformContextDirect2D& ?

> Source/WebCore/platform/graphics/win/PlatformContextDirect2D.cpp:89
> +\    // We must call savePlatformState at least once before we can use image masking,

You probably don't want this \

> Source/WebCore/platform/graphics/win/PlatformContextDirect2D.h:123
> +    State* m_state;

{ nullptr }

> Source/WebCore/platform/win/DragImageWin.cpp:176
> +    ASSERT(0);

notImplemented()?
Comment 7 Brent Fulgham 2019-07-30 14:02:24 PDT
Comment on attachment 375172 [details]
Patch

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

>> Source/WebCore/platform/win/DragImageWin.cpp:176
>> +    ASSERT(0);
> 
> notImplemented()?

No! This should be uncommented. I'll fix.
Comment 8 Brent Fulgham 2019-07-30 14:52:12 PDT
Created attachment 375182 [details]
Patch for landing
Comment 9 WebKit Commit Bot 2019-07-30 15:36:22 PDT
Comment on attachment 375182 [details]
Patch for landing

Clearing flags on attachment: 375182

Committed r248020: <https://trac.webkit.org/changeset/248020>
Comment 10 WebKit Commit Bot 2019-07-30 15:36:23 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Radar WebKit Bug Importer 2019-07-30 15:37:19 PDT
<rdar://problem/53731210>