Bug 191577 - [cairo] BackingStore::incorporateUpdate should use CompositeCopy to support drawsBackground=false in general Cairo ports
Summary: [cairo] BackingStore::incorporateUpdate should use CompositeCopy to support d...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-12 21:02 PST by Tomoki Imai
Modified: 2018-11-19 13:23 PST (History)
5 users (show)

See Also:


Attachments
Test HTML which doesn't have background color. (1.27 KB, text/html)
2018-11-12 21:02 PST, Tomoki Imai
no flags Details
Actual result of the testcase (286.07 KB, image/png)
2018-11-12 21:06 PST, Tomoki Imai
no flags Details
Use CompositeCopy to update bitmap to overwrite existing surface (3.43 KB, patch)
2018-11-12 21:18 PST, Tomoki Imai
no flags Details | Formatted Diff | Diff
Use CompositeCopy to update bitmap to overwrite existing surface (3.56 KB, patch)
2018-11-12 21:39 PST, Tomoki Imai
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomoki Imai 2018-11-12 21:02:25 PST
Created attachment 354641 [details]
Test HTML which doesn't have background color.

I'm trying to implement a transparent background feature in Cairo port, and found that it works only in GTK+ port because of BackingStore::incorporateUpdate.

# How to reproduce

The other cairo ports doesn't have transparent background feature yet, but this is reproducable in GTK+ port by removing platform specific code.

1. Delete GTK+ specific code from BackingStore::incorporateUpdate
- https://trac.webkit.org/browser/webkit/trunk/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp?rev=227728#L96
2. Build WebKitGTK+ as usual
3. Run MiniBrowser with custom background color.
- $ Tools/Scripts/run-minibrowser --gtk --bg-color="rgba(0,0,0,0)"
4. Go to webpage which doesn't have background.
- You can use attached HTML file.

# Expected result

The webpage's background becomes transparent.

# Actual result

You see collapsed image because previous image are not cleared. (I'll attach image)

I'll post the patch.
Comment 1 Tomoki Imai 2018-11-12 21:06:08 PST
Created attachment 354644 [details]
Actual result of the testcase

At first, MiniBrowser opens WebKitGTK+ webpage. 
After that, I opened Attachment 354641 [details].
Comment 2 Tomoki Imai 2018-11-12 21:18:49 PST
Created attachment 354645 [details]
Use CompositeCopy to update bitmap to overwrite existing surface

We should set graphicsContext.setCompositeOperation(WebCore::CompositeCopy) before updating surface.
We should overwrite existing surface by the source even if it contains non opaque parts.
Comment 3 Tomoki Imai 2018-11-12 21:39:00 PST
Created attachment 354649 [details]
Use CompositeCopy to update bitmap to overwrite existing surface

I updated ChangeLog as the bugtitle doesn't match to bugzilla, and the style is different from the others.
Comment 4 Tomoki Imai 2018-11-12 21:45:22 PST
I guess we can get rid of GTK+ specific code from BackingStore::incorporateUpdate if user-defined background color is used in WebProcess side.
https://trac.webkit.org/browser/webkit/trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp?rev=238057#L2817
Comment 5 Carlos Garcia Campos 2018-11-19 02:20:43 PST
Comment on attachment 354649 [details]
Use CompositeCopy to update bitmap to overwrite existing surface

Ok.
Comment 6 WebKit Commit Bot 2018-11-19 13:22:57 PST
Comment on attachment 354649 [details]
Use CompositeCopy to update bitmap to overwrite existing surface

Clearing flags on attachment: 354649

Committed r238379: <https://trac.webkit.org/changeset/238379>
Comment 7 WebKit Commit Bot 2018-11-19 13:22:59 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2018-11-19 13:23:32 PST
<rdar://problem/46173057>