Skip to content

Commit 10f54bd

Browse files
author
shawnsingh@chromium.org
committed
Revert "Make compositingState explicit (re-land #2 with bogus ASSERT removed)"
This is in an attempt to remove the crashing occurring on tip of tree. There's no strong reason to suspect this patch except that this patch was a bit large. BUG=306096 TBR=kareng@chromium.org, vollick@chromium.org Review URL: https://codereview.chromium.org/27030009 git-svn-id: svn://svn.chromium.org/blink/trunk@159473 bbb929c8-8fbe-4397-9dbb-9b2b20218538
1 parent ce4d4e0 commit 10f54bd

23 files changed

+117
-190
lines changed

Source/core/css/CSSComputedStyleDeclaration.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1616,8 +1616,7 @@ PassRefPtr<RenderStyle> CSSComputedStyleDeclaration::computeRenderStyle(CSSPrope
16161616
Node* styledNode = this->styledNode();
16171617
ASSERT(styledNode);
16181618
RenderObject* renderer = styledNode->renderer();
1619-
if (renderer && renderer->compositingState() == PaintsIntoOwnBacking
1620-
&& !RuntimeEnabledFeatures::webAnimationsCSSEnabled() && AnimationController::supportsAcceleratedAnimationOfProperty(propertyID)) {
1619+
if (renderer && renderer->isComposited() && !RuntimeEnabledFeatures::webAnimationsCSSEnabled() && AnimationController::supportsAcceleratedAnimationOfProperty(propertyID)) {
16211620
AnimationUpdateBlock animationUpdateBlock(renderer->animation());
16221621
if (m_pseudoElementSpecifier && !styledNode->isPseudoElement()) {
16231622
// FIXME: This cached pseudo style will only exist if the animation has been run at least once.

Source/core/frame/FrameView.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ void FrameView::updateCanBlitOnScrollRecursively()
12591259
bool FrameView::contentsInCompositedLayer() const
12601260
{
12611261
RenderView* renderView = this->renderView();
1262-
if (renderView && renderView->compositingState() == PaintsIntoOwnBacking) {
1262+
if (renderView && renderView->isComposited()) {
12631263
GraphicsLayer* layer = renderView->layer()->compositedLayerMapping()->mainGraphicsLayer();
12641264
if (layer && layer->drawsContent())
12651265
return true;
@@ -1376,10 +1376,10 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect
13761376
ASSERT(renderer->hasLayer());
13771377
RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
13781378

1379-
// Layers that paint into their ancestor or into a grouped backing will still need
1380-
// to apply a repaint invalidation. If the layer paints into its own backing, then
1381-
// it does not need repainting just to scroll.
1382-
if (layer->compositingState() == PaintsIntoOwnBacking)
1379+
// Composited layers may still actually paint into their ancestor.
1380+
// If that happens, the viewport constrained object needs to be
1381+
// repainted on scroll.
1382+
if (layer->isComposited() && !layer->compositedLayerMapping()->paintsIntoCompositedAncestor())
13831383
continue;
13841384

13851385
if (layer->viewportConstrainedNotCompositedReason() == RenderLayer::NotCompositedForBoundsOutOfView

Source/core/frame/animation/AnimationBase.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,8 @@ void AnimationBase::freezeAtTime(double t)
555555
else
556556
m_pauseTime = m_startTime + t - m_animation->delay();
557557

558-
// It is possible that m_isAccelerated is true and m_object->compositingState() is NotComposited, because of style change.
559-
// So, both conditions need to be checked.
560-
if (m_object && m_object->compositingState() == PaintsIntoOwnBacking && isAccelerated())
558+
// It is possible that m_isAccelerated is true and m_object->isComposited() is false, because of style change.
559+
if (m_object && m_object->isComposited() && isAccelerated())
561560
toRenderBoxModelObject(m_object)->suspendAnimations(m_pauseTime);
562561
}
563562

Source/core/frame/animation/ImplicitAnimation.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void ImplicitAnimation::getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle)
104104

105105
void ImplicitAnimation::startAnimation(double timeOffset)
106106
{
107-
if (m_object && m_object->compositingState() == PaintsIntoOwnBacking)
107+
if (m_object && m_object->isComposited())
108108
m_isAccelerated = toRenderBoxModelObject(m_object)->startTransition(timeOffset, m_animatingProperty, m_fromStyle.get(), m_toStyle.get());
109109
}
110110

@@ -113,7 +113,7 @@ void ImplicitAnimation::pauseAnimation(double timeOffset)
113113
if (!m_object)
114114
return;
115115

116-
if (m_object && m_object->compositingState() == PaintsIntoOwnBacking && isAccelerated())
116+
if (m_object && m_object->isComposited() && isAccelerated())
117117
toRenderBoxModelObject(m_object)->transitionPaused(timeOffset, m_animatingProperty);
118118

119119
// Restore the original (unanimated) style
@@ -123,7 +123,7 @@ void ImplicitAnimation::pauseAnimation(double timeOffset)
123123

124124
void ImplicitAnimation::endAnimation()
125125
{
126-
if (m_object && m_object->compositingState() == PaintsIntoOwnBacking && isAccelerated())
126+
if (m_object && m_object->isComposited() && isAccelerated())
127127
toRenderBoxModelObject(m_object)->transitionFinished(m_animatingProperty);
128128
m_isAccelerated = false;
129129
}

Source/core/frame/animation/KeyframeAnimation.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ bool KeyframeAnimation::hasAnimationForProperty(CSSPropertyID property) const
239239

240240
void KeyframeAnimation::startAnimation(double timeOffset)
241241
{
242-
if (m_object && m_object->compositingState() == PaintsIntoOwnBacking)
242+
if (m_object && m_object->isComposited())
243243
m_isAccelerated = toRenderBoxModelObject(m_object)->startAnimation(timeOffset, m_animation.get(), m_keyframes);
244244
}
245245

@@ -248,7 +248,7 @@ void KeyframeAnimation::pauseAnimation(double timeOffset)
248248
if (!m_object)
249249
return;
250250

251-
if (m_object && m_object->compositingState() == PaintsIntoOwnBacking && isAccelerated())
251+
if (m_object && m_object->isComposited() && isAccelerated())
252252
toRenderBoxModelObject(m_object)->animationPaused(timeOffset, m_keyframes.animationName());
253253

254254
// Restore the original (unanimated) style
@@ -261,7 +261,7 @@ void KeyframeAnimation::endAnimation()
261261
if (!m_object)
262262
return;
263263

264-
if (m_object && m_object->compositingState() == PaintsIntoOwnBacking && isAccelerated())
264+
if (m_object && m_object->isComposited() && isAccelerated())
265265
toRenderBoxModelObject(m_object)->animationFinished(m_keyframes.animationName());
266266
m_isAccelerated = false;
267267

Source/core/inspector/InspectorLayerTreeAgent.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void InspectorLayerTreeAgent::getLayers(ErrorString* errorString, const int* nod
204204

205205
void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(ErrorString* errorString, RenderLayer* root, LayerIdToNodeIdMap& layerIdToNodeIdMap)
206206
{
207-
if (root->compositedLayerMapping()) {
207+
if (root->isComposited()) {
208208
if (Node* node = root->renderer()->generatingNode()) {
209209
GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->childForSuperlayers();
210210
layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNode(errorString, node));

Source/core/page/scrolling/ScrollingCoordinator.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static void clearPositionConstraintExceptForLayer(GraphicsLayer* layer, Graphics
158158

159159
static WebLayerPositionConstraint computePositionConstraint(const RenderLayer* layer)
160160
{
161-
ASSERT(layer->compositedLayerMapping());
161+
ASSERT(layer->isComposited());
162162
do {
163163
if (layer->renderer()->style()->position() == FixedPosition) {
164164
const RenderObject* fixedPositionObject = layer->renderer();
@@ -168,10 +168,7 @@ static WebLayerPositionConstraint computePositionConstraint(const RenderLayer* l
168168
}
169169

170170
layer = layer->parent();
171-
172-
// Composited layers that inherit a fixed position state will be positioned with respect to the nearest compositedLayerMapping's GraphicsLayer.
173-
// So, once we find a layer that has its own compositedLayerMapping, we can stop searching for a fixed position RenderObject.
174-
} while (layer && layer->compositedLayerMapping());
171+
} while (layer && !layer->isComposited());
175172
return WebLayerPositionConstraint();
176173
}
177174

@@ -808,12 +805,12 @@ bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
808805
return true;
809806
RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)->layer();
810807
// Any explicit reason that a fixed position element is not composited shouldn't cause slow scrolling.
811-
if (layer->compositingState() != PaintsIntoOwnBacking && layer->viewportConstrainedNotCompositedReason() == RenderLayer::NoNotCompositedReason)
808+
if (!layer->isComposited() && layer->viewportConstrainedNotCompositedReason() == RenderLayer::NoNotCompositedReason)
812809
return true;
813810

814811
// Composited layers that actually paint into their enclosing ancestor
815812
// must also force main thread scrolling.
816-
if (layer->compositingState() == HasOwnBackingButPaintsIntoAncestor)
813+
if (layer->isComposited() && layer->compositedLayerMapping()->paintsIntoCompositedAncestor())
817814
return true;
818815
}
819816
return false;

Source/core/rendering/CompositedLayerMapping.cpp

+8-17
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry()
696696
m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
697697
}
698698

699-
if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->compositedLayerMapping()) {
699+
if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->isComposited()) {
700700
CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer->reflectionLayer()->compositedLayerMapping();
701701
reflectionCompositedLayerMapping->updateGraphicsLayerGeometry();
702702

@@ -1197,16 +1197,9 @@ float CompositedLayerMapping::compositingOpacity(float rendererOpacity) const
11971197
if (!curr->isStackingContainer())
11981198
continue;
11991199

1200-
// If we found a composited layer, regardless of whether it actually
1201-
// paints into it, we want to compute opacity relative to it. So we can
1202-
// break here.
1203-
//
1204-
// FIXME: with grouped backings, a composited descendant will have to
1205-
// continue past the grouped (squashed) layers that its parents may
1206-
// contribute to. This whole confusion can be avoided by specifying
1207-
// explicitly the composited ancestor where we would stop accumulating
1208-
// opacity.
1209-
if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositingState() == HasOwnBackingButPaintsIntoAncestor)
1200+
// If we found a compositing layer, we want to compute opacity
1201+
// relative to it. So we can break here.
1202+
if (curr->isComposited())
12101203
break;
12111204

12121205
finalOpacity *= curr->renderer()->opacity();
@@ -1344,7 +1337,7 @@ static bool hasVisibleNonCompositingDescendant(RenderLayer* parent)
13441337
size_t listSize = normalFlowList->size();
13451338
for (size_t i = 0; i < listSize; ++i) {
13461339
RenderLayer* curLayer = normalFlowList->at(i);
1347-
if (!curLayer->compositedLayerMapping()
1340+
if (!curLayer->isComposited()
13481341
&& (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
13491342
return true;
13501343
}
@@ -1359,7 +1352,7 @@ static bool hasVisibleNonCompositingDescendant(RenderLayer* parent)
13591352
size_t listSize = negZOrderList->size();
13601353
for (size_t i = 0; i < listSize; ++i) {
13611354
RenderLayer* curLayer = negZOrderList->at(i);
1362-
if (!curLayer->compositedLayerMapping()
1355+
if (!curLayer->isComposited()
13631356
&& (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
13641357
return true;
13651358
}
@@ -1369,7 +1362,7 @@ static bool hasVisibleNonCompositingDescendant(RenderLayer* parent)
13691362
size_t listSize = posZOrderList->size();
13701363
for (size_t i = 0; i < listSize; ++i) {
13711364
RenderLayer* curLayer = posZOrderList->at(i);
1372-
if (!curLayer->compositedLayerMapping()
1365+
if (!curLayer->isComposited()
13731366
&& (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
13741367
return true;
13751368
}
@@ -1379,9 +1372,7 @@ static bool hasVisibleNonCompositingDescendant(RenderLayer* parent)
13791372
return false;
13801373
}
13811374

1382-
// FIXME: By name the implementation is correct. But the code that uses this function means something
1383-
// very slightly different - the implementation needs to also include composited descendants that
1384-
// don't paint into their own backing, and instead paint into this backing.
1375+
// Conservative test for having no rendered children.
13851376
bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const
13861377
{
13871378
return hasVisibleNonCompositingDescendant(m_owningLayer);

Source/core/rendering/CompositingState.h

-25
This file was deleted.

Source/core/rendering/RenderBox.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -1258,8 +1258,7 @@ static bool isCandidateForOpaquenessTest(RenderBox* childBox)
12581258
if (!childBox->width() || !childBox->height())
12591259
return false;
12601260
if (RenderLayer* childLayer = childBox->layer()) {
1261-
// FIXME: perhaps this could be less conservative?
1262-
if (childLayer->compositingState() != NotComposited)
1261+
if (childLayer->isComposited())
12631262
return false;
12641263
// FIXME: Deal with z-index.
12651264
if (!childStyle->hasAutoZIndex())
@@ -1354,13 +1353,9 @@ void RenderBox::paintClippingMask(PaintInfo& paintInfo, const LayoutPoint& paint
13541353
if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseClippingMask || paintInfo.context->paintingDisabled())
13551354
return;
13561355

1357-
if (!layer() || layer()->compositingState() != PaintsIntoOwnBacking)
1356+
if (!layer() || !layer()->isComposited())
13581357
return;
13591358

1360-
// We should never have this state in this function. A layer with a mask
1361-
// should have always created its own backing if it became composited.
1362-
ASSERT(layer()->compositingState() != HasOwnBackingButPaintsIntoAncestor);
1363-
13641359
LayoutRect paintRect = LayoutRect(paintOffset, size());
13651360
paintInfo.context->fillRect(pixelSnappedIntRect(paintRect), Color::black);
13661361
}

Source/core/rendering/RenderBoxModelObject.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -102,49 +102,49 @@ bool RenderBoxModelObject::hasAcceleratedCompositing() const
102102
bool RenderBoxModelObject::startTransition(double timeOffset, CSSPropertyID propertyId, const RenderStyle* fromStyle, const RenderStyle* toStyle)
103103
{
104104
ASSERT(hasLayer());
105-
ASSERT(compositingState() == PaintsIntoOwnBacking);
105+
ASSERT(isComposited());
106106
return layer()->compositedLayerMapping()->startTransition(timeOffset, propertyId, fromStyle, toStyle);
107107
}
108108

109109
void RenderBoxModelObject::transitionPaused(double timeOffset, CSSPropertyID propertyId)
110110
{
111111
ASSERT(hasLayer());
112-
ASSERT(compositingState() == PaintsIntoOwnBacking);
112+
ASSERT(isComposited());
113113
layer()->compositedLayerMapping()->transitionPaused(timeOffset, propertyId);
114114
}
115115

116116
void RenderBoxModelObject::transitionFinished(CSSPropertyID propertyId)
117117
{
118118
ASSERT(hasLayer());
119-
ASSERT(compositingState() == PaintsIntoOwnBacking);
119+
ASSERT(isComposited());
120120
layer()->compositedLayerMapping()->transitionFinished(propertyId);
121121
}
122122

123123
bool RenderBoxModelObject::startAnimation(double timeOffset, const CSSAnimationData* animation, const KeyframeList& keyframes)
124124
{
125125
ASSERT(hasLayer());
126-
ASSERT(compositingState() == PaintsIntoOwnBacking);
126+
ASSERT(isComposited());
127127
return layer()->compositedLayerMapping()->startAnimation(timeOffset, animation, keyframes);
128128
}
129129

130130
void RenderBoxModelObject::animationPaused(double timeOffset, const String& name)
131131
{
132132
ASSERT(hasLayer());
133-
ASSERT(compositingState() == PaintsIntoOwnBacking);
133+
ASSERT(isComposited());
134134
layer()->compositedLayerMapping()->animationPaused(timeOffset, name);
135135
}
136136

137137
void RenderBoxModelObject::animationFinished(const String& name)
138138
{
139139
ASSERT(hasLayer());
140-
ASSERT(compositingState() == PaintsIntoOwnBacking);
140+
ASSERT(isComposited());
141141
layer()->compositedLayerMapping()->animationFinished(name);
142142
}
143143

144144
void RenderBoxModelObject::suspendAnimations(double time)
145145
{
146146
ASSERT(hasLayer());
147-
ASSERT(compositingState() == PaintsIntoOwnBacking);
147+
ASSERT(isComposited());
148148
layer()->compositedLayerMapping()->suspendAnimations(time);
149149
}
150150

@@ -984,7 +984,7 @@ bool RenderBoxModelObject::fixedBackgroundPaintsInLocalCoordinates() const
984984
return false;
985985

986986
RenderLayer* rootLayer = view()->layer();
987-
if (!rootLayer || rootLayer->compositingState() == NotComposited)
987+
if (!rootLayer || !rootLayer->isComposited())
988988
return false;
989989

990990
return rootLayer->compositedLayerMapping()->backgroundLayerPaintsFixedRootBackground();

0 commit comments

Comments
 (0)