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

Unified Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp

Issue 2161523002: Isolation of subtrees of stacking contexts and out-of-flow positioned objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@CachePaintProperties
Patch Set: - Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
index 5e552c2b831d41bcbec65d4804ad153d25362798..1e955955282fb9d1c35a009164d3c44b621af452 100644
--- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
+++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
@@ -122,14 +122,19 @@ static gfx::Transform transformToTransformSpace(const TransformPaintPropertyNode
TransformationMatrix localMatrix = currentSpace->matrix();
localMatrix.applyTransformOrigin(currentSpace->origin());
matrix = localMatrix * matrix;
- currentSpace = currentSpace->parent();
+ currentSpace = currentSpace->nonIsolationParent();
}
return gfx::Transform(TransformationMatrix::toSkMatrix44(matrix));
}
const TransformPaintPropertyNode* localTransformSpace(const ClipPaintPropertyNode* clip)
{
- return clip ? clip->localTransformSpace() : nullptr;
+ if (!clip)
+ return nullptr;
+ DCHECK(!clip->isIsolationNode());
+ if (const TransformPaintPropertyNode* transform = clip->localTransformSpace())
+ return transform->nonIsolationNode();
+ return nullptr;
}
scoped_refptr<cc::Layer> createClipLayer(const ClipPaintPropertyNode* node)
@@ -144,11 +149,12 @@ scoped_refptr<cc::Layer> createClipLayer(const ClipPaintPropertyNode* node)
// TODO(jbroman): This assumes that the transform space of this node's
// parent is an ancestor of this node's transform space. That's not
// necessarily true, and this should be fixed. crbug.com/597156
- gfx::Transform transform = transformToTransformSpace(localTransformSpace(node), localTransformSpace(node->parent()));
+ const ClipPaintPropertyNode* parentClip = node->nonIsolationParent();
+ gfx::Transform transform = transformToTransformSpace(localTransformSpace(node), localTransformSpace(parentClip));
gfx::Vector2dF offset = clipRect.OffsetFromOrigin();
transform.Translate(offset.x(), offset.y());
- if (node->parent()) {
- FloatPoint offsetDueToParentClipOffset = node->parent()->clipRect().rect().location();
+ if (parentClip) {
+ FloatPoint offsetDueToParentClipOffset = parentClip->clipRect().rect().location();
gfx::Transform undoClipOffset;
undoClipOffset.Translate(-offsetDueToParentClipOffset.x(), -offsetDueToParentClipOffset.y());
transform.ConcatTransform(undoClipOffset);
@@ -192,7 +198,7 @@ public:
if (childLayer)
clipLayer->AddChild(std::move(childLayer));
childLayer = std::move(clipLayer);
- clip = clip->parent();
+ clip = clip->nonIsolationParent();
} while (ancestor != clip);
ancestorClipLayer->AddChild(std::move(childLayer));
@@ -288,17 +294,18 @@ void PaintArtifactCompositor::update(const PaintArtifact& paintArtifact)
m_contentLayerClients.reserveCapacity(paintArtifact.paintChunks().size());
ClipLayerManager clipLayerManager(m_rootLayer.get());
for (const PaintChunk& paintChunk : paintArtifact.paintChunks()) {
- cc::Layer* parent = clipLayerManager.switchToNewClipLayer(paintChunk.properties.clip.get());
+ const ClipPaintPropertyNode* clip = paintChunk.properties.clip->nonIsolationNode();
+ cc::Layer* parent = clipLayerManager.switchToNewClipLayer(clip);
gfx::Vector2dF layerOffset;
scoped_refptr<cc::Layer> layer = layerForPaintChunk(paintArtifact, paintChunk, layerOffset);
// TODO(jbroman): Same as above. This assumes the transform space of the current clip is
// an ancestor of the chunk. It is not necessarily true. crbug.com/597156
- gfx::Transform transform = transformToTransformSpace(paintChunk.properties.transform.get(), localTransformSpace(paintChunk.properties.clip.get()));
+ gfx::Transform transform = transformToTransformSpace(paintChunk.properties.transform->nonIsolationNode(), localTransformSpace(clip));
transform.Translate(layerOffset.x(), layerOffset.y());
// If a clip was applied, its origin needs to be cancelled out in
// this transform.
- if (const auto* clip = paintChunk.properties.clip.get()) {
+ if (clip) {
FloatPoint offsetDueToClipOffset = clip->clipRect().rect().location();
gfx::Transform undoClipOffset;
undoClipOffset.Translate(-offsetDueToClipOffset.x(), -offsetDueToClipOffset.y());
@@ -400,7 +407,7 @@ int PropertyTreeManager::compositorIdForTransformNode(const TransformPaintProper
return it->value;
scoped_refptr<cc::Layer> dummyLayer = cc::Layer::Create();
- int parentId = compositorIdForTransformNode(transformNode->parent());
+ int parentId = compositorIdForTransformNode(transformNode->nonIsolationParent());
int id = transformTree().Insert(cc::TransformNode(), parentId);
cc::TransformNode& compositorNode = *transformTree().Node(id);
@@ -439,7 +446,7 @@ int PropertyTreeManager::compositorIdForClipNode(const ClipPaintPropertyNode* cl
return it->value;
scoped_refptr<cc::Layer> dummyLayer = cc::Layer::Create();
- int parentId = compositorIdForClipNode(clipNode->parent());
+ int parentId = compositorIdForClipNode(clipNode->nonIsolationParent());
int id = clipTree().Insert(cc::ClipNode(), parentId);
cc::ClipNode& compositorNode = *clipTree().Node(id);
@@ -447,7 +454,7 @@ int PropertyTreeManager::compositorIdForClipNode(const ClipPaintPropertyNode* cl
// TODO(jbroman): Don't discard rounded corners.
compositorNode.clip = clipNode->clipRect().rect();
- compositorNode.transform_id = compositorIdForTransformNode(clipNode->localTransformSpace());
+ compositorNode.transform_id = compositorIdForTransformNode(localTransformSpace(clipNode));
compositorNode.target_transform_id = kRealRootNodeId;
compositorNode.applies_local_clip = true;
compositorNode.layers_are_clipped = true;
@@ -494,7 +501,7 @@ const EffectPaintPropertyNode* lowestCommonAncestor(const EffectPaintPropertyNod
nodeA = nodeA->parent();
nodeB = nodeB->parent();
}
- return nodeA;
+ return nodeA ? nodeA->nonIsolationNode() : nullptr;
}
int PropertyTreeManager::switchToEffectNode(const EffectPaintPropertyNode& nextEffect)
@@ -518,8 +525,8 @@ void PropertyTreeManager::buildEffectNodesRecursively(const EffectPaintPropertyN
return;
DCHECK(nextEffect);
- buildEffectNodesRecursively(nextEffect->parent());
- DCHECK_EQ(nextEffect->parent(), currentEffectNode());
+ buildEffectNodesRecursively(nextEffect->nonIsolationParent());
+ DCHECK_EQ(nextEffect->nonIsolationParent(), currentEffectNode());
#if DCHECK_IS_ON()
DCHECK(!m_effectNodesConverted.contains(nextEffect)) << "Malformed paint artifact. Paint chunks under the same effect should be contiguous.";
@@ -572,9 +579,9 @@ void PaintArtifactCompositor::updateInLayerListMode(const PaintArtifact& paintAr
gfx::Vector2dF layerOffset;
scoped_refptr<cc::Layer> layer = layerForPaintChunk(paintArtifact, paintChunk, layerOffset);
- int transformId = propertyTreeManager.compositorIdForTransformNode(paintChunk.properties.transform.get());
- int clipId = propertyTreeManager.compositorIdForClipNode(paintChunk.properties.clip.get());
- int effectId = propertyTreeManager.switchToEffectNode(*paintChunk.properties.effect.get());
+ int transformId = propertyTreeManager.compositorIdForTransformNode(paintChunk.properties.transform->nonIsolationNode());
+ int clipId = propertyTreeManager.compositorIdForClipNode(paintChunk.properties.clip->nonIsolationNode());
+ int effectId = propertyTreeManager.switchToEffectNode(*paintChunk.properties.effect->nonIsolationNode());
layer->set_offset_to_transform_parent(layerOffset);

Powered by Google App Engine
This is Rietveld 408576698