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

Issue 11883027: Fix masks when scaling is in the tree (Closed)

Created:
7 years, 11 months ago by piman
Modified:
7 years, 11 months ago
Reviewers:
danakj, enne (OOO)
CC:
chromium-reviews, cc-bugs_chromium.org
Visibility:
Public.

Description

Fix masks when scaling is in the tree Because the render surface is sized according to the screen-space footprint, there is a scaling factor introduced between the RS and the owning layer, that was not taken into account for masks. This fixes that. BUG=163045 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=176850

Patch Set 1 #

Total comments: 3

Patch Set 2 : Add test #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+141 lines, -2 lines) Patch
M cc/layer_tree_host_impl_unittest.cc View 1 1 chunk +133 lines, -0 lines 0 comments Download
M cc/render_surface_impl.cc View 1 chunk +8 lines, -2 lines 3 comments Download

Messages

Total messages: 14 (0 generated)
piman
7 years, 11 months ago (2013-01-15 01:12:22 UTC) #1
danakj
Can we have a test for this, probably in LTHCommonTests? https://codereview.chromium.org/11883027/diff/1/cc/render_surface_impl.cc File cc/render_surface_impl.cc (right): https://codereview.chromium.org/11883027/diff/1/cc/render_surface_impl.cc#newcode233 ...
7 years, 11 months ago (2013-01-15 01:15:43 UTC) #2
piman
For the test, I'll see what I can do, I don't think LTHCommonTests is appropriate ...
7 years, 11 months ago (2013-01-15 01:35:57 UTC) #3
danakj
Thanks for doing all the legwork on this one. https://codereview.chromium.org/11883027/diff/1/cc/render_surface_impl.cc File cc/render_surface_impl.cc (right): https://codereview.chromium.org/11883027/diff/1/cc/render_surface_impl.cc#newcode233 cc/render_surface_impl.cc:233: ...
7 years, 11 months ago (2013-01-15 01:39:05 UTC) #4
piman
I added a LayerTreeHostImplTest which seemed like the best fit.
7 years, 11 months ago (2013-01-15 03:15:37 UTC) #5
enne (OOO)
lgtm to land this fix, especially since you're adding tests. I think maybe this could ...
7 years, 11 months ago (2013-01-15 04:12:43 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/piman@chromium.org/11883027/8001
7 years, 11 months ago (2013-01-15 04:24:57 UTC) #7
piman
On Mon, Jan 14, 2013 at 8:12 PM, <enne@chromium.org> wrote: > lgtm to land this ...
7 years, 11 months ago (2013-01-15 04:32:09 UTC) #8
commit-bot: I haz the power
Change committed as 176850
7 years, 11 months ago (2013-01-15 08:30:42 UTC) #9
danakj
lgtm2 and thanks for the test! https://codereview.chromium.org/11883027/diff/8001/cc/render_surface_impl.cc File cc/render_surface_impl.cc (right): https://codereview.chromium.org/11883027/diff/8001/cc/render_surface_impl.cc#newcode232 cc/render_surface_impl.cc:232: gfx::Vector2dF maskDrawScale = ...
7 years, 11 months ago (2013-01-15 16:31:10 UTC) #10
danakj
https://codereview.chromium.org/11883027/diff/8001/cc/render_surface_impl.cc File cc/render_surface_impl.cc (right): https://codereview.chromium.org/11883027/diff/8001/cc/render_surface_impl.cc#newcode232 cc/render_surface_impl.cc:232: gfx::Vector2dF maskDrawScale = MathUtil::computeTransform2dScaleComponents(m_owningLayer->drawTransform(), 1.f); On 2013/01/15 16:31:11, danakj ...
7 years, 11 months ago (2013-01-15 17:11:53 UTC) #11
danakj
On 2013/01/15 17:11:53, danakj wrote: > So I guess we want to scale it to ...
7 years, 11 months ago (2013-01-15 17:16:57 UTC) #12
danakj
Filed http://code.google.com/p/chromium/issues/detail?id=170076 to clean this up for m26.
7 years, 11 months ago (2013-01-15 17:19:32 UTC) #13
piman
7 years, 11 months ago (2013-01-15 19:12:43 UTC) #14
On Tue, Jan 15, 2013 at 9:11 AM, <danakj@chromium.org> wrote:

>
> https://codereview.chromium.**org/11883027/diff/8001/cc/**
>
render_surface_impl.cc<https://codereview.chromium.org/11883027/diff/8001/cc/render_surface_impl.cc>
> File cc/render_surface_impl.cc (right):
>
> https://codereview.chromium.**org/11883027/diff/8001/cc/**
>
render_surface_impl.cc#**newcode232<https://codereview.chromium.org/11883027/diff/8001/cc/render_surface_impl.cc#newcode232>
> cc/render_surface_impl.cc:232: gfx::Vector2dF maskDrawScale =
> MathUtil::**computeTransform2dScaleCompone**nts(m_owningLayer->**
> drawTransform(),
> 1.f);
> On 2013/01/15 16:31:11, danakj wrote:
>
>> On 2013/01/15 04:12:43, enne wrote:
>> > This will work given the current implementation of LTHCommon, but I
>>
> had once
>
>> > hoped that we could separate the scale of the owning layer from the
>>
> scale of
>
>> the
>> > surface (in case you had some image with a bizarre scale that
>>
> created a
>
>> surface,
>> > and then everything inside would get scaled to it).  It almost seems
>>
> like the
>
>> > mask layer's content's scale should just take this surface scale
>>
> into account
>
>> > and then this owning layer detail could be entirely hidden in
>> > LayerTreeHostCommon.
>>
>
>  I'm not sure I agree. My POV is that the mask is assumed to share the
>>
> same
>
>> contents scale as the owning layer, so I think the mask needs to be
>>
> drawn with
>
>> the same scale as the owning layer is. The "surface's scale" is in
>>
> theory
>
>> independent of the owning layer's draw transform, but the mask layer
>>
> should
>
>> continue to draw at the same scale as the owning layer to have its
>>
> pixel
>
>> positions aligned.
>>
>
> Ok I take this back. I had developed an impression that the mask only
> applies to its layer. But enne@ pointed me to
>
https://www.webkit.org/blog/**181/css-masks/<https://www.webkit.org/blog/181/...
it states:
>
> "The mask will therefore overlay the child and all of its descendants"
>
> So I guess we want to scale it to fill the entire render surface.
>

The client (web contents) can do that if it desires, but I don't think we
want to do that in the compositor.

Which makes me then wonder why this wasn't working for this case.


We don't currently do that (resizing the mask to fit the surface) in the
compositor.


> Is it
> because the mask layer was being added to the root layer, so the
> contentRect of the surface didn't match the size of the subtree?


The mask isn't added to the root layer, it's added to the layer it's
intended to mask. AFAIK in our case there's a single layer with no sub-tree.
However, there is a scale higher up in the tree, that makes the render
surface size to not match the content layer size. The content layer gets
applied a scale to compensate, the mask was not - now it is.


> or
> because aura is drawing a mask assuming it matches the size of the
> owning layer and not its subtree?
>

It is allocating and drawing a mask assuming it matches the size of the
owning layer, there is no subtree to take into account.


>
>
https://codereview.chromium.**org/11883027/<https://codereview.chromium.org/1...
>

Powered by Google App Engine
This is Rietveld 408576698