Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Issue 2495373003: Match html canvas which is transferred to OffscreenCanvas to CSS style (Closed)

Created:
4 years, 1 month ago by xlai (Olivia)
Modified:
4 years ago
CC:
chromium-reviews, dshwang, ajuma+watch-canvas_chromium.org, blink-reviews-html_chromium.org, jam, dglazkov+blink, Rik, darin-cc_chromium.org, blink-reviews, piman+watch_chromium.org, cc-bugs_chromium.org, kinuko+watch, blink-worker-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Match html canvas which is transferred to OffscreenCanvas to CSS style This CL aims to make html canvas to match to CSS style restriction regardless whether it is transferred to OffscreenCanvas or not. In a usual compositor commit, when a css style is imposed on the html canvas to change its width and height, its layer will reset a different bounds. However, in the case when html canvas has transferred control to offscreen, it is using a SurfaceLayer, which directly use surface_size_ without incorporating layer bounds to append SurfaceDrawQuad. This CL changes SurfaceLayerImpl to take into account the special case when layer bounds is different from surface_size by doing a transformation on the Quad, especially when the aspect ratio is different. The CL respects existing non-canvas cases on high-dpi devices and settings when enable-use-zoom-for-dsf is on or off. Also, it is also possible that the compositor commit due to style change happens before the Surface Layer for html canvas is created. To prevent flakiness, we force a compositor commit at the time when Surface Layer is created and registered to GraphicsLayers. TBR=khushalsagar@chromium.org, twellington@chromium.org, pfeldman@chromium.org BUG=655335, 652931 CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel Committed: https://crrev.com/5e87e713d6ed8c36fb37b814c6b65e7096d4554e Cr-Commit-Position: refs/heads/master@{#438986}

Patch Set 1 #

Total comments: 4

Patch Set 2 : unit test #

Patch Set 3 : fix #

Patch Set 4 : added deterministic gpu tests and fix high dpi issue #

Patch Set 5 : spelling error #

Total comments: 13

Patch Set 6 : fix #

Patch Set 7 : Separate canvas case from others #

Patch Set 8 : fix #

Patch Set 9 : fix #

Total comments: 39

Patch Set 10 : rebase #

Patch Set 11 : fix basedd on feedback #

Total comments: 7

Patch Set 12 : rebase #

Patch Set 13 : final fix #

Patch Set 14 : fix compilation error #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+356 lines, -28 lines) Patch
M blimp/client/core/compositor/blimp_compositor.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 1 comment Download
M cc/layers/heads_up_display_layer_impl.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M cc/layers/layer_impl.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -1 line 0 comments Download
M cc/layers/layer_impl.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +10 lines, -6 lines 0 comments Download
M cc/layers/painted_scrollbar_layer_impl.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M cc/layers/picture_layer_impl.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M cc/layers/surface_layer.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +5 lines, -2 lines 0 comments Download
M cc/layers/surface_layer.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +5 lines, -3 lines 0 comments Download
M cc/layers/surface_layer_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +3 lines, -1 line 0 comments Download
M cc/layers/surface_layer_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +24 lines, -2 lines 0 comments Download
M cc/layers/surface_layer_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +59 lines, -0 lines 0 comments Download
M cc/layers/surface_layer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -3 lines 0 comments Download
M content/renderer/child_frame_compositing_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -1 line 0 comments Download
A content/test/data/gpu/pixel_offscreenCanvas_transfer_after_style_resize.html View 1 2 3 4 5 1 chunk +100 lines, -0 lines 0 comments Download
A content/test/data/gpu/pixel_offscreenCanvas_transfer_before_style_resize.html View 1 2 3 4 5 1 chunk +100 lines, -0 lines 0 comments Download
M content/test/gpu/gpu_tests/pixel_expectations.py View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +6 lines, -0 lines 0 comments Download
M content/test/gpu/gpu_tests/pixel_test_pages.py View 1 2 3 4 5 6 7 8 9 1 chunk +14 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +9 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M ui/android/delegated_frame_host_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -1 line 1 comment Download
M ui/compositor/layer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 94 (60 generated)
xlai (Olivia)
4 years, 1 month ago (2016-11-14 20:10:58 UTC) #6
Ken Russell (switch to Gerrit)
The test changes lgtm - I defer to others' review of the rest.
4 years, 1 month ago (2016-11-14 20:21:37 UTC) #8
Justin Novosad
Where is the code that pushes the CSS size to the compositor when the style ...
4 years, 1 month ago (2016-11-14 20:41:27 UTC) #9
danakj
https://codereview.chromium.org/2495373003/diff/1/cc/layers/surface_layer_impl.cc File cc/layers/surface_layer_impl.cc (right): https://codereview.chromium.org/2495373003/diff/1/cc/layers/surface_layer_impl.cc#newcode71 cc/layers/surface_layer_impl.cc:71: gfx::Transform scaled_draw_transform = New code requires new unit tests ...
4 years, 1 month ago (2016-11-14 20:44:06 UTC) #10
xlai (Olivia)
Unit test added. On 2016/11/14 20:41:27, Justin Novosad wrote: > Where is the code that ...
4 years, 1 month ago (2016-11-15 16:36:21 UTC) #11
Justin Novosad
So, if updating the CSS style after the SurfaceLayer has been created works as it ...
4 years, 1 month ago (2016-11-15 21:19:34 UTC) #16
xlai (Olivia)
On 2016/11/15 21:19:34, Justin Novosad wrote: > So, if updating the CSS style after the ...
4 years, 1 month ago (2016-11-15 21:29:31 UTC) #17
Justin Novosad
On 2016/11/15 21:29:31, xlai (Olivia) wrote: > On 2016/11/15 21:19:34, Justin Novosad wrote: > > ...
4 years, 1 month ago (2016-11-15 21:31:29 UTC) #18
xlai (Olivia)
On 2016/11/15 21:31:29, Justin Novosad wrote: > On 2016/11/15 21:29:31, xlai (Olivia) wrote: > > ...
4 years, 1 month ago (2016-11-15 21:34:16 UTC) #19
Justin Novosad
On 2016/11/15 21:34:16, xlai (Olivia) wrote: > On 2016/11/15 21:31:29, Justin Novosad wrote: > > ...
4 years, 1 month ago (2016-11-15 21:42:27 UTC) #20
Justin Novosad
FYI, the reason I wrote "That is terrible": flake is often dismissed, or even worse, ...
4 years, 1 month ago (2016-11-15 21:44:58 UTC) #21
xlai (Olivia)
Justin, I think there was something that I didn't realize when I was explaining the ...
4 years, 1 month ago (2016-11-16 18:14:22 UTC) #26
Justin Novosad
On 2016/11/16 18:14:22, xlai (Olivia) wrote: > Justin, I think there was something that I ...
4 years, 1 month ago (2016-11-16 18:22:45 UTC) #27
xlai (Olivia)
junov@: I've replaced the modified gpu pixel tests with two new dedicated gpu pixel tests ...
4 years, 1 month ago (2016-11-18 13:53:21 UTC) #35
Justin Novosad
lgtm with nits. https://codereview.chromium.org/2495373003/diff/100001/content/test/data/gpu/pixel_offscreenCanvas_transfer_after_style_resize.html File content/test/data/gpu/pixel_offscreenCanvas_transfer_after_style_resize.html (right): https://codereview.chromium.org/2495373003/diff/100001/content/test/data/gpu/pixel_offscreenCanvas_transfer_after_style_resize.html#newcode88 content/test/data/gpu/pixel_offscreenCanvas_transfer_after_style_resize.html:88: window.webkitRequestAnimationFrame(waitForFinish); the "webkit" prefix is obsolete ...
4 years, 1 month ago (2016-11-18 15:07:27 UTC) #36
xlai (Olivia)
gentle ping to danakj@.
4 years, 1 month ago (2016-11-21 15:43:40 UTC) #42
danakj
https://codereview.chromium.org/2495373003/diff/100001/cc/layers/surface_layer_impl.cc File cc/layers/surface_layer_impl.cc (right): https://codereview.chromium.org/2495373003/diff/100001/cc/layers/surface_layer_impl.cc#newcode74 cc/layers/surface_layer_impl.cc:74: float boundsWidth = bounds().width(); chromium style, though I'd drop ...
4 years, 1 month ago (2016-11-21 23:37:23 UTC) #44
xlai (Olivia)
+cc weiliangc@ https://codereview.chromium.org/2495373003/diff/100001/cc/layers/surface_layer_impl.cc File cc/layers/surface_layer_impl.cc (right): https://codereview.chromium.org/2495373003/diff/100001/cc/layers/surface_layer_impl.cc#newcode74 cc/layers/surface_layer_impl.cc:74: float boundsWidth = bounds().width(); On 2016/11/21 23:37:22, ...
4 years, 1 month ago (2016-11-22 16:55:59 UTC) #45
danakj
Hope this helps, look carefully cuz I might have made mistakes but hopefully all the ...
4 years, 1 month ago (2016-11-22 19:19:13 UTC) #46
weiliangc
Haven't read through but I'll just try reply to first part first. On 2016/11/22 at ...
4 years, 1 month ago (2016-11-22 20:28:40 UTC) #47
xlai (Olivia)
On 2016/11/22 20:28:40, weiliangc wrote: > Haven't read through but I'll just try reply to ...
4 years, 1 month ago (2016-11-22 21:00:17 UTC) #48
weiliangc
On 2016/11/22 at 20:28:40, weiliangc wrote: > Haven't read through but I'll just try reply ...
4 years, 1 month ago (2016-11-22 21:06:49 UTC) #49
xlai (Olivia)
After discussion with danakj@ and weiliangc@, I give up trying a universal approach that works ...
4 years ago (2016-11-23 17:08:50 UTC) #50
xlai (Olivia)
After talking with weiliangc@, agree to add surface_scale_ into the computation to make it more ...
4 years ago (2016-11-23 20:38:12 UTC) #59
danakj
On 2016/11/23 20:38:12, xlai (Olivia) wrote: > After talking with weiliangc@, agree to add surface_scale_ ...
4 years ago (2016-11-24 02:09:47 UTC) #62
weiliangc
On 2016/11/24 at 02:09:47, danakj wrote: > On 2016/11/23 20:38:12, xlai (Olivia) wrote: > > ...
4 years ago (2016-11-24 20:32:49 UTC) #63
xlai (Olivia)
Thanks a lot for the super detailed explanation:-) Now I can clearly differentiate the difference ...
4 years ago (2016-11-25 17:11:58 UTC) #68
danakj
LG thanks, some smaller comments https://codereview.chromium.org/2495373003/diff/200001/cc/layers/layer_impl.cc File cc/layers/layer_impl.cc (right): https://codereview.chromium.org/2495373003/diff/200001/cc/layers/layer_impl.cc#newcode180 cc/layers/layer_impl.cc:180: void LayerImpl::PopulateScaledSharedQuadState(SharedQuadState* state, I ...
4 years ago (2016-11-28 22:26:23 UTC) #69
xlai (Olivia)
I just come back from a long vacation and continue to fix this patch. danakj@: ...
4 years ago (2016-12-13 17:29:19 UTC) #73
danakj
LGTM w/ a few last things https://codereview.chromium.org/2495373003/diff/300001/cc/layers/surface_layer_impl.cc File cc/layers/surface_layer_impl.cc (right): https://codereview.chromium.org/2495373003/diff/300001/cc/layers/surface_layer_impl.cc#newcode56 cc/layers/surface_layer_impl.cc:56: void SurfaceLayerImpl::SetStretchContentToFillBounds(bool is_scaling_needed) ...
4 years ago (2016-12-15 16:13:14 UTC) #74
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2495373003/360001
4 years ago (2016-12-16 01:29:24 UTC) #88
commit-bot: I haz the power
Committed patchset #14 (id:360001)
4 years ago (2016-12-16 02:11:17 UTC) #91
commit-bot: I haz the power
Patchset 14 (id:??) landed as https://crrev.com/5e87e713d6ed8c36fb37b814c6b65e7096d4554e Cr-Commit-Position: refs/heads/master@{#438986}
4 years ago (2016-12-16 02:13:55 UTC) #93
danakj
4 years ago (2016-12-16 14:30:45 UTC) #94
Message was sent while issue was closed.
Couple typoes to fix in followup

https://codereview.chromium.org/2495373003/diff/300001/cc/layers/surface_laye...
File cc/layers/surface_layer_impl.cc (right):

https://codereview.chromium.org/2495373003/diff/300001/cc/layers/surface_laye...
cc/layers/surface_layer_impl.cc:82: // It is possible that the surface size and
its layer bounds are changed
"Strecthes" => "Stretches"

https://codereview.chromium.org/2495373003/diff/360001/blimp/client/core/comp...
File blimp/client/core/compositor/blimp_compositor.cc (right):

https://codereview.chromium.org/2495373003/diff/360001/blimp/client/core/comp...
blimp/client/core/compositor/blimp_compositor.cc:337: surface_size, false /*
strecth_content_to_fill_bounds */);
"strecth" => stretch

https://codereview.chromium.org/2495373003/diff/360001/ui/android/delegated_f...
File ui/android/delegated_frame_host_android.cc (right):

https://codereview.chromium.org/2495373003/diff/360001/ui/android/delegated_f...
ui/android/delegated_frame_host_android.cc:56: false /*
strecth_content_to_fill_bounds */);
"strecth" => stretch

Powered by Google App Engine
This is Rietveld 408576698