| Differences between
and this patch
- a/Source/WebCore/ChangeLog +12 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2020-05-03  David Kilzer  <ddkilzer@apple.com>
2
3
        Use LocalCurrentGraphicsContext in WebKit::convertPlatformImageToBitmap()
4
        <https://webkit.org/b/211274>
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * platform/mac/LocalCurrentGraphicsContext.h:
9
        (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext):
10
        (WebCore::LocalCurrentGraphicsContext::~LocalCurrentGraphicsContext):
11
        - Export methods for use in WebKit.
12
1
2020-05-02  Daniel Bates  <dabates@apple.com>
13
2020-05-02  Daniel Bates  <dabates@apple.com>
2
14
3
        Page::editableElementsInRect() should return root editable elements
15
        Page::editableElementsInRect() should return root editable elements
- a/Source/WebKit/ChangeLog +11 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2020-05-03  David Kilzer  <ddkilzer@apple.com>
2
3
        Use LocalCurrentGraphicsContext in WebKit::convertPlatformImageToBitmap()
4
        <https://webkit.org/b/211274>
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
9
        (WebKit::convertPlatformImageToBitmap):
10
        - Use LocalCurrentGraphicsContext to replace code.
11
1
2020-05-02  Simon Fraser  <simon.fraser@apple.com>
12
2020-05-02  Simon Fraser  <simon.fraser@apple.com>
2
13
3
        handleWheelEventPhase() should include the relevant ScrollingNodeID
14
        handleWheelEventPhase() should include the relevant ScrollingNodeID
- a/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h -2 / +2 lines
Lines 33-40 namespace WebCore { a/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h_sec1
33
class LocalCurrentGraphicsContext {
33
class LocalCurrentGraphicsContext {
34
    WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext);
34
    WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext);
35
public:
35
public:
36
    LocalCurrentGraphicsContext(GraphicsContext&);
36
    WEBCORE_EXPORT LocalCurrentGraphicsContext(GraphicsContext&);
37
    ~LocalCurrentGraphicsContext();
37
    WEBCORE_EXPORT ~LocalCurrentGraphicsContext();
38
    CGContextRef cgContext();
38
    CGContextRef cgContext();
39
private:
39
private:
40
    GraphicsContext& m_savedGraphicsContext;
40
    GraphicsContext& m_savedGraphicsContext;
- a/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm -7 / +6 lines
Lines 400-416 static RefPtr<WebKit::ShareableBitmap> convertPlatformImageToBitmap(CocoaImage * a/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm_sec1
400
    auto graphicsContext = bitmap->createGraphicsContext();
400
    auto graphicsContext = bitmap->createGraphicsContext();
401
    if (!graphicsContext)
401
    if (!graphicsContext)
402
        return nullptr;
402
        return nullptr;
403
403
#if PLATFORM(IOS_FAMILY)
404
#if PLATFORM(IOS_FAMILY)
404
    UIGraphicsPushContext(graphicsContext->platformContext());
405
    UIGraphicsPushContext(graphicsContext->platformContext());
405
    [image drawInRect:CGRectMake(0, 0, bitmap->size().width(), bitmap->size().height())];
406
    [image drawInRect:CGRectMake(0, 0, bitmap->size().width(), bitmap->size().height())];
406
    UIGraphicsPopContext();
407
    UIGraphicsPopContext();
407
#elif PLATFORM(MAC)
408
#elif USE(APPKIT)
408
    auto savedContext = retainPtr([NSGraphicsContext currentContext]);
409
    {
409
410
        LocalCurrentGraphicsContext savedContext(*graphicsContext);
410
    [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:graphicsContext->platformContext() flipped:YES]];
411
        [image drawInRect:NSMakeRect(0, 0, bitmap->size().width(), bitmap->size().height()) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1 respectFlipped:YES hints:nil];
411
    [image drawInRect:NSMakeRect(0, 0, bitmap->size().width(), bitmap->size().height()) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1 respectFlipped:YES hints:nil];
412
    }
412
413
    [NSGraphicsContext setCurrentContext:savedContext.get()];
414
#endif
413
#endif
415
    return bitmap;
414
    return bitmap;
416
}
415
}

Return to Bug 211274