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

Issue 59063003: Don't coerce pointers to compositor layer mappings to booleans. (Closed)

Created:
7 years, 1 month ago by Ian Vollick
Modified:
7 years, 1 month ago
Reviewers:
caseq, hartmanng, shawnsingh
CC:
blink-reviews, eae+blinkwatch, apavlov+blink_chromium.org, pdr, aandrey+blink_chromium.org, vsevik+blink_chromium.org, caseq+blink_chromium.org, bemjb+rendering_chromium.org, yurys+blink_chromium.org, jchaffraix+rendering, devtools-reviews_chromium.org, kenneth.christiansen, loislo+blink_chromium.org, zoltan1, lushnikov+blink_chromium.org, eustas+blink_chromium.org, paulirish+reviews_chromium.org, alph+blink_chromium.org, leviw+renderwatch, blink-layers+watch_chromium.org, pfeldman+blink_chromium.org, f(malita), Stephen Chennney
Visibility:
Public.

Description

Don't coerce pointers to compositor layer mappings to booleans. Using compositedLayerMapping() in a boolean expression is an error -- there are in fact three compositing states, and there may be more in the future. This subtlety cannot be captured with a boolean. This CL updates the current code so that our intentions are explicit, and it prevents future abuses through a thin wrapper around a CompositedLayerMapping* that cannot be coerced to a boolean value. This patch includes much of shawn's change to use a hasCompositedLayerMapping() accessor: https://codereview.chromium.org/58543002/ R=shawnsingh@chromium.org BUG=

Patch Set 1 #

Patch Set 2 : rebaaaase #

Total comments: 31

Patch Set 3 : Fixed ASSERTS and a circular dependency in CompositedLayerMapping::updateCompositedBounds. #

Total comments: 1

Patch Set 4 : . #

Total comments: 2

Patch Set 5 : Respond to reviewer feedback. #

Total comments: 29
Unified diffs Side-by-side diffs Delta from patch set Stats (+245 lines, -132 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 1 chunk +8 lines, -0 lines 0 comments Download
M Source/core/core.gypi View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/frame/FrameView.cpp View 1 2 3 4 2 chunks +3 lines, -2 lines 0 comments Download
M Source/core/inspector/InspectorLayerTreeAgent.cpp View 1 2 2 chunks +10 lines, -4 lines 5 comments Download
M Source/core/page/scrolling/ScrollingCoordinator.cpp View 1 2 6 chunks +44 lines, -10 lines 2 comments Download
M Source/core/rendering/CompositedLayerMapping.cpp View 1 2 3 4 5 chunks +19 lines, -35 lines 0 comments Download
A Source/core/rendering/CompositedLayerMappingPtr.h View 1 2 1 chunk +39 lines, -0 lines 0 comments Download
M Source/core/rendering/RenderLayer.h View 1 2 2 chunks +4 lines, -2 lines 2 comments Download
M Source/core/rendering/RenderLayer.cpp View 1 2 3 4 16 chunks +39 lines, -19 lines 10 comments Download
M Source/core/rendering/RenderLayerCompositor.cpp View 1 2 3 4 23 chunks +39 lines, -37 lines 2 comments Download
M Source/core/rendering/RenderLayerModelObject.h View 1 2 3 4 2 chunks +3 lines, -1 line 0 comments Download
M Source/core/rendering/RenderLayerModelObject.cpp View 1 2 3 4 1 chunk +6 lines, -1 line 0 comments Download
M Source/core/rendering/RenderLayerRepainter.cpp View 1 2 5 chunks +10 lines, -6 lines 4 comments Download
M Source/core/rendering/RenderLayerScrollableArea.cpp View 1 2 3 4 3 chunks +6 lines, -6 lines 0 comments Download
M Source/core/rendering/RenderTreeAsText.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/svg/SVGRenderingContext.cpp View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M Source/core/testing/Internals.cpp View 1 2 3 4 2 chunks +4 lines, -2 lines 2 comments Download
M Source/web/LinkHighlight.cpp View 1 2 1 chunk +1 line, -1 line 2 comments Download
M Source/web/tests/ScrollingCoordinatorChromiumTest.cpp View 1 2 3 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
shawnsingh
So after getting halfway, I began to formulate three thoughts: (1) Did you remember that ...
7 years, 1 month ago (2013-11-05 10:20:26 UTC) #1
shawnsingh
Oh - two thoughts not three.
7 years, 1 month ago (2013-11-05 10:22:48 UTC) #2
Ian Vollick
Blergh, you're right. I misunderstood the point of the composited-but-paints-into-ancestor state. I think there are ...
7 years, 1 month ago (2013-11-08 03:35:11 UTC) #3
Ian Vollick
There was a bug in the timing of computing require-own-backing-for-ancestor-reasons that showed up as a ...
7 years, 1 month ago (2013-11-08 16:12:34 UTC) #4
hartmanng
Looks good for the most part, I plan to take another look later (tomorrow?) though ...
7 years, 1 month ago (2013-11-08 22:51:04 UTC) #5
Ian Vollick
On 2013/11/08 22:51:04, hartmanng wrote: > Looks good for the most part, I plan to ...
7 years, 1 month ago (2013-11-11 15:29:48 UTC) #6
shawnsingh
So far so good - but still a lot of comments. This patch is definitely ...
7 years, 1 month ago (2013-11-12 09:55:49 UTC) #7
shawnsingh
I'm beginning to feel that we should definitely break this patch into baby steps: (1) ...
7 years, 1 month ago (2013-11-12 10:05:25 UTC) #8
caseq
https://codereview.chromium.org/59063003/diff/450001/Source/core/inspector/InspectorLayerTreeAgent.cpp File Source/core/inspector/InspectorLayerTreeAgent.cpp (right): https://codereview.chromium.org/59063003/diff/450001/Source/core/inspector/InspectorLayerTreeAgent.cpp#newcode156 Source/core/inspector/InspectorLayerTreeAgent.cpp:156: // Note, that this only gets called with the ...
7 years, 1 month ago (2013-11-13 15:45:19 UTC) #9
Ian Vollick
On 2013/11/13 15:45:19, caseq wrote: > https://codereview.chromium.org/59063003/diff/450001/Source/core/inspector/InspectorLayerTreeAgent.cpp > File Source/core/inspector/InspectorLayerTreeAgent.cpp (right): > > https://codereview.chromium.org/59063003/diff/450001/Source/core/inspector/InspectorLayerTreeAgent.cpp#newcode156 > ...
7 years, 1 month ago (2013-11-13 16:47:43 UTC) #10
Ian Vollick
7 years, 1 month ago (2013-11-14 04:12:46 UTC) #11
Message was sent while issue was closed.
Even though this patch shouldn't be necessary, I thought a response to your
comments could be helpful when you go to migrate the hasCompositedLayerMapping()
call sites to compositingState() for squashing.

https://codereview.chromium.org/59063003/diff/450001/Source/core/inspector/In...
File Source/core/inspector/InspectorLayerTreeAgent.cpp (right):

https://codereview.chromium.org/59063003/diff/450001/Source/core/inspector/In...
Source/core/inspector/InspectorLayerTreeAgent.cpp:188: if
(root->compositingState() == PaintsIntoOwnBacking) {
On 2013/11/13 15:45:20, caseq wrote:
> On 2013/11/12 09:55:50, shawnsingh wrote:
> > 
> > Isn't this a scenario where we really only care whether the
> > compositedLayerMapping exists or not, so that the layer-to-node map
represents
> > the same information as RenderLayer-owns-CLM relationships? If you disagree,
> can
> > you please explain more clearly why we cannot just use
> > hasCompositedLayerMapping()?
> 
> +1 to what Shawn says.
> Since the mere presence of CLM means we do have at least a main graphics
layer,
> event if this render layer is painted elsewhere, we want that layer to be
> associated with the actual owner node that caused it to appear.
> 

Agreed.

https://codereview.chromium.org/59063003/diff/450001/Source/core/page/scrolli...
File Source/core/page/scrolling/ScrollingCoordinator.cpp (right):

https://codereview.chromium.org/59063003/diff/450001/Source/core/page/scrolli...
Source/core/page/scrolling/ScrollingCoordinator.cpp:216: } while (layer &&
layer->hasCompositedLayerMapping());
On 2013/11/12 09:55:50, shawnsingh wrote:
> Actually the code existing before your patch is wrong because I made a mistake
> in my compositingState patch. 
>
https://codereview.chromium.org/26156006/diff/8001/Source/core/page/scrolling...
> 
> I accidentally lost the "!" negation operator in the refactoring process.  I
> think we need to fix that in a separate patch because there is almost
certainly
> something we will need to merge back to the m32 branch for this.  It turns out
> that there is no difference in correctness (possibly wrong for pinch-zoom on
the
> impl thread, but not for basic positioning), because either way the layer will
> get fixed to something else that is fixed.
> 
> So I believe your FIXME is unnecessary - please feel free to discuss if you
> think otherwise =)
K, cool :)

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
File Source/core/rendering/RenderLayer.cpp (right):

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
Source/core/rendering/RenderLayer.cpp:539: if (compositingState() ==
PaintsIntoOwnBacking)
On 2013/11/12 09:55:50, shawnsingh wrote:
> 
> Wouldn't blend-mode still work for a layer that paints into an ancestor,
because
> it would then use the software implementation of blend-modes within the other
> layer?  So I think it is valid to accept both compositing states
> PaintsIntoOwnBacking and HasOwnBackingButPaintsIntoAncestor.  Code elsewhere
> with paintsWithBlendMode() will recognize in that scenario that it needs to
use
> the software blend mode implementation.
> 
> If you agree, I think this is a scenario where we could go ahead and use
> compositingState() to define the condition rather than
> hasCompositedLayerMapping().

It's my impression that the paints-into-ancestor mode was for creating GL's for
clipping, preserves3d'ing and perspective'ifying composited descendants -- not
for painting. The blend mode is still available via the style. Isn't that what
will be consulted when we paint this layer into its composited ancestor?

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
Source/core/rendering/RenderLayer.cpp:1004: if (compositingState() ==
PaintsIntoOwnBacking) {
On 2013/11/12 09:55:50, shawnsingh wrote:
> I think this will break for a scenario where a layer has compositingState
> HasOwnBackingButPaintsIntoAncestor and is located on the second column. 
Either
> it will get positioned incorrectly because the CompositedLayerMapping assumes
> that the "composited" layer is positioned correctly including it's
multi-column
> offset, or it may get hit tested incorrectly for a similar reason.

I think a layer that paints-into-ancestor would itself draw fine (I think the
painting code would get it positioned correctly), but I'm now nervous about the
composited descendants -- I bet they won't be positioned correctly if we skip
this. I think we need a layout test here.

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
Source/core/rendering/RenderLayer.cpp:1207: if (compositingState() ==
PaintsIntoOwnBacking)
On 2013/11/12 09:55:50, shawnsingh wrote:
> red flag in comment - "only for layers that own a backing" --> includes layers
> that HasOwnBackingButPaintsIntoAncestor.  So either the comment is wrong or
the
> condition is wrong?

VWhen I say "own a backing", I mean owns a mapping that is painted into. Could
we distinguish between mapping and backing? Is there better verbage we could be
using?

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
Source/core/rendering/RenderLayer.cpp:3604: if
(!reflectionLayer->hasCompositedLayerMapping()) {
I should mention that my assumption (which I should have enforced with an ASSERT
here) was the reflection would either paint into the same backing as |this| or
it would paint into its own backing.

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
Source/core/rendering/RenderLayer.cpp:3621: if (flags &
IncludeCompositedDescendants || node->layer()->compositingState() !=
PaintsIntoOwnBacking) {
On 2013/11/12 09:55:50, shawnsingh wrote:
> 
> Can we get a layout test for this?  I had made this a FIXME (which you can
> remove 2 lines above this) because we ought to regard this a bug and get a
> layout test that reproduces the incorrect composited layer bounds. 

Actually, this is hit by a layout test:
transforms/3d/point-mapping/3d-point-mapping-deep.html

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
File Source/core/rendering/RenderLayer.h (right):

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
Source/core/rendering/RenderLayer.h:353: bool hasCompositedLayerMapping() const
{ return m_compositedLayerMapping.get(); }
On 2013/11/12 09:55:50, shawnsingh wrote:
> I think the NOTE 3 lines above should apply to this new bool function, now.
They have been moved in the hasCLM patch.

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
File Source/core/rendering/RenderLayerCompositor.cpp (right):

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
Source/core/rendering/RenderLayerCompositor.cpp:1535: if
(layer->compositingState() != PaintsIntoOwnBacking || !layer->parent())
On 2013/11/12 09:55:50, shawnsingh wrote:
> Seems correct, but I have to admit I'm too tired right now to reason through
> this one.

It's another one that could use a layout test.

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
File Source/core/rendering/RenderLayerRepainter.cpp (right):

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
Source/core/rendering/RenderLayerRepainter.cpp:140: if (curr->compositingState()
== NotComposited)
On 2013/11/12 09:55:50, shawnsingh wrote:
> 
> I don't understand this FIXME... why cant we just write:
>   if (curr->compositingState() == NotComposited || curr->compositingState() ==
> HasOwnBackingButPaintsIntoAncestor)
> 
> which would be equivalent to the previous code, and address your FIXME all at
> the same time?

Ah right. We want to paint those layers that paint into our repaint container,
but I was worried that the paints-into-ancestor layers may paint into some other
container (is that impossible? seems quite possible in the world of squashing).
I put the FIXME here so I could add the container comparison code in another
patch.

https://codereview.chromium.org/59063003/diff/450001/Source/core/rendering/Re...
Source/core/rendering/RenderLayerRepainter.cpp:152: if
(child->compositingState() != NotComposited)
On 2013/11/12 09:55:50, shawnsingh wrote:
> This code doesn't seem to require a FIXME, either?
Same as above.

https://codereview.chromium.org/59063003/diff/450001/Source/core/testing/Inte...
File Source/core/testing/Internals.cpp (right):

https://codereview.chromium.org/59063003/diff/450001/Source/core/testing/Inte...
Source/core/testing/Internals.cpp:1275: if (searchRoot->compositingState() ==
PaintsIntoOwnBacking && graphicsLayer ==
searchRoot->compositedLayerMapping()->mainGraphicsLayer())
On 2013/11/12 09:55:50, shawnsingh wrote:
> 
> I think this is incorrect - the searchRoot would still own its CLM even if it
> painted into ancestor.

You're totally right. This was a mistake.

https://codereview.chromium.org/59063003/diff/450001/Source/web/LinkHighlight...
File Source/web/LinkHighlight.cpp (right):

https://codereview.chromium.org/59063003/diff/450001/Source/web/LinkHighlight...
Source/web/LinkHighlight.cpp:134: ASSERT(renderLayer->compositingState() ==
PaintsIntoOwnBacking &&
renderLayer->compositedLayerMapping()->scrollingContentsLayer());
On 2013/11/12 09:55:50, shawnsingh wrote:
> 
> Can you please explain? I actually am not familiar with the role/function of
> link highlights.

It's just that if the renderLayer uses composited scrolling, it'll totally paint
into its own backing.

Powered by Google App Engine
This is Rietveld 408576698