| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h" | 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h" |
| 6 | 6 |
| 7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/layers/picture_layer.h" | 9 #include "cc/layers/picture_layer.h" |
| 10 #include "cc/playback/display_item_list.h" | 10 #include "cc/playback/display_item_list.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 const auto& foreignLayerDisplayItem = | 262 const auto& foreignLayerDisplayItem = |
| 263 static_cast<const ForeignLayerDisplayItem&>(displayItem); | 263 static_cast<const ForeignLayerDisplayItem&>(displayItem); |
| 264 layerOffset = gfx::Vector2dF(foreignLayerDisplayItem.location().x(), | 264 layerOffset = gfx::Vector2dF(foreignLayerDisplayItem.location().x(), |
| 265 foreignLayerDisplayItem.location().y()); | 265 foreignLayerDisplayItem.location().y()); |
| 266 scoped_refptr<cc::Layer> layer = foreignLayerDisplayItem.layer(); | 266 scoped_refptr<cc::Layer> layer = foreignLayerDisplayItem.layer(); |
| 267 layer->SetBounds(foreignLayerDisplayItem.bounds()); | 267 layer->SetBounds(foreignLayerDisplayItem.bounds()); |
| 268 layer->SetIsDrawable(true); | 268 layer->SetIsDrawable(true); |
| 269 return layer; | 269 return layer; |
| 270 } | 270 } |
| 271 | 271 |
| 272 constexpr int kInvalidNodeId = -1; |
| 272 // cc's property trees use 0 for the root node (always non-null). | 273 // cc's property trees use 0 for the root node (always non-null). |
| 273 constexpr int kRealRootNodeId = 0; | 274 constexpr int kRealRootNodeId = 0; |
| 274 // cc allocates special nodes for root effects such as the device scale. | 275 // cc allocates special nodes for root effects such as the device scale. |
| 275 constexpr int kSecondaryRootNodeId = 1; | 276 constexpr int kSecondaryRootNodeId = 1; |
| 276 constexpr int kPropertyTreeSequenceNumber = 1; | 277 constexpr int kPropertyTreeSequenceNumber = 1; |
| 277 | 278 |
| 278 // Creates a minimal set of property trees for the compositor. | |
| 279 void setMinimalPropertyTrees(cc::PropertyTrees* propertyTrees, int ownerId) { | |
| 280 // cc is hardcoded to use transform node index 1 for device scale and | |
| 281 // transform. | |
| 282 cc::TransformTree& transformTree = propertyTrees->transform_tree; | |
| 283 transformTree.clear(); | |
| 284 cc::TransformNode& transformNode = *transformTree.Node( | |
| 285 transformTree.Insert(cc::TransformNode(), kRealRootNodeId)); | |
| 286 DCHECK_EQ(transformNode.id, kSecondaryRootNodeId); | |
| 287 transformNode.source_node_id = transformNode.parent_id; | |
| 288 transformTree.SetTargetId(transformNode.id, kRealRootNodeId); | |
| 289 transformTree.SetContentTargetId(transformNode.id, kRealRootNodeId); | |
| 290 | |
| 291 // cc is hardcoded to use clip node index 1 for viewport clip. | |
| 292 cc::ClipTree& clipTree = propertyTrees->clip_tree; | |
| 293 clipTree.clear(); | |
| 294 cc::ClipNode& clipNode = | |
| 295 *clipTree.Node(clipTree.Insert(cc::ClipNode(), kRealRootNodeId)); | |
| 296 DCHECK_EQ(clipNode.id, kSecondaryRootNodeId); | |
| 297 clipNode.owner_id = ownerId; | |
| 298 | |
| 299 // cc is hardcoded to use effect node index 1 for root render surface. | |
| 300 cc::EffectTree& effectTree = propertyTrees->effect_tree; | |
| 301 effectTree.clear(); | |
| 302 cc::EffectNode& effectNode = | |
| 303 *effectTree.Node(effectTree.Insert(cc::EffectNode(), kRealRootNodeId)); | |
| 304 DCHECK_EQ(effectNode.id, kSecondaryRootNodeId); | |
| 305 effectNode.owner_id = ownerId; | |
| 306 effectNode.clip_id = clipNode.id; | |
| 307 effectNode.has_render_surface = true; | |
| 308 | |
| 309 cc::ScrollTree& scrollTree = propertyTrees->scroll_tree; | |
| 310 scrollTree.clear(); | |
| 311 cc::ScrollNode& scrollNode = | |
| 312 *scrollTree.Node(scrollTree.Insert(cc::ScrollNode(), kRealRootNodeId)); | |
| 313 DCHECK_EQ(scrollNode.id, kSecondaryRootNodeId); | |
| 314 scrollNode.owner_id = ownerId; | |
| 315 scrollNode.transform_id = kRealRootNodeId; | |
| 316 } | |
| 317 | |
| 318 } // namespace | 279 } // namespace |
| 319 | 280 |
| 320 std::unique_ptr<PaintArtifactCompositor::ContentLayerClientImpl> | 281 std::unique_ptr<PaintArtifactCompositor::ContentLayerClientImpl> |
| 321 PaintArtifactCompositor::clientForPaintChunk( | 282 PaintArtifactCompositor::clientForPaintChunk( |
| 322 const PaintChunk& paintChunk, | 283 const PaintChunk& paintChunk, |
| 323 const PaintArtifact& paintArtifact) { | 284 const PaintArtifact& paintArtifact) { |
| 324 // TODO(chrishtr): for now, just using a linear walk. In the future we can | 285 // TODO(chrishtr): for now, just using a linear walk. In the future we can |
| 325 // optimize this by using the same techniques used in PaintController for | 286 // optimize this by using the same techniques used in PaintController for |
| 326 // display lists. | 287 // display lists. |
| 327 for (auto& client : m_contentLayerClients) { | 288 for (auto& client : m_contentLayerClients) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 348 |
| 388 namespace { | 349 namespace { |
| 389 | 350 |
| 390 class PropertyTreeManager { | 351 class PropertyTreeManager { |
| 391 WTF_MAKE_NONCOPYABLE(PropertyTreeManager); | 352 WTF_MAKE_NONCOPYABLE(PropertyTreeManager); |
| 392 | 353 |
| 393 public: | 354 public: |
| 394 PropertyTreeManager(cc::PropertyTrees& propertyTrees, cc::Layer* rootLayer) | 355 PropertyTreeManager(cc::PropertyTrees& propertyTrees, cc::Layer* rootLayer) |
| 395 : m_propertyTrees(propertyTrees), | 356 : m_propertyTrees(propertyTrees), |
| 396 m_rootLayer(rootLayer) | 357 m_rootLayer(rootLayer) |
| 397 #if DCHECK_IS_ON() | |
| 398 , | |
| 399 m_isFirstEffectEver(true) | |
| 400 #endif | |
| 401 { | 358 { |
| 402 m_effectStack.append(BlinkEffectAndCcIdPair{nullptr, kSecondaryRootNodeId}); | 359 setupRootTransformNode(); |
| 360 setupRootClipNode(); |
| 361 setupRootEffectNode(); |
| 362 setupRootScrollNode(); |
| 403 } | 363 } |
| 404 | 364 |
| 405 // TODO(pdr): This will need to be unified with how viewport scale works. | 365 void setupRootTransformNode(); |
| 406 void setDeviceScaleFactor(float); | 366 void setupRootClipNode(); |
| 367 void setupRootEffectNode(); |
| 368 void setupRootScrollNode(); |
| 407 | 369 |
| 408 int compositorIdForTransformNode(const TransformPaintPropertyNode*); | 370 int compositorIdForTransformNode(const TransformPaintPropertyNode*); |
| 409 int compositorIdForClipNode(const ClipPaintPropertyNode*); | 371 int compositorIdForClipNode(const ClipPaintPropertyNode*); |
| 410 int switchToEffectNode(const EffectPaintPropertyNode& nextEffect); | 372 int switchToEffectNode(const EffectPaintPropertyNode& nextEffect); |
| 411 int compositorIdForCurrentEffectNode() const { | 373 int compositorIdForCurrentEffectNode() const { |
| 412 return m_effectStack.last().id; | 374 return m_effectStack.last().id; |
| 413 } | 375 } |
| 414 int compositorIdForScrollNode(const ScrollPaintPropertyNode*); | 376 int compositorIdForScrollNode(const ScrollPaintPropertyNode*); |
| 415 | 377 |
| 416 // Scroll offset has special treatment in the transform and scroll trees. | 378 // Scroll offset has special treatment in the transform and scroll trees. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 441 HashMap<const ScrollPaintPropertyNode*, int> m_scrollNodeMap; | 403 HashMap<const ScrollPaintPropertyNode*, int> m_scrollNodeMap; |
| 442 | 404 |
| 443 struct BlinkEffectAndCcIdPair { | 405 struct BlinkEffectAndCcIdPair { |
| 444 const EffectPaintPropertyNode* effect; | 406 const EffectPaintPropertyNode* effect; |
| 445 int id; | 407 int id; |
| 446 }; | 408 }; |
| 447 Vector<BlinkEffectAndCcIdPair> m_effectStack; | 409 Vector<BlinkEffectAndCcIdPair> m_effectStack; |
| 448 | 410 |
| 449 #if DCHECK_IS_ON() | 411 #if DCHECK_IS_ON() |
| 450 HashSet<const EffectPaintPropertyNode*> m_effectNodesConverted; | 412 HashSet<const EffectPaintPropertyNode*> m_effectNodesConverted; |
| 451 bool m_isFirstEffectEver; | |
| 452 #endif | 413 #endif |
| 453 }; | 414 }; |
| 454 | 415 |
| 455 void PropertyTreeManager::setDeviceScaleFactor(float deviceScaleFactor) { | 416 void PropertyTreeManager::setupRootTransformNode() { |
| 417 // cc is hardcoded to use transform node index 1 for device scale and |
| 418 // transform. |
| 419 cc::TransformTree& transformTree = m_propertyTrees.transform_tree; |
| 420 transformTree.clear(); |
| 421 cc::TransformNode& transformNode = *transformTree.Node( |
| 422 transformTree.Insert(cc::TransformNode(), kRealRootNodeId)); |
| 423 DCHECK_EQ(transformNode.id, kSecondaryRootNodeId); |
| 424 transformNode.source_node_id = transformNode.parent_id; |
| 425 transformTree.SetTargetId(transformNode.id, kRealRootNodeId); |
| 426 transformTree.SetContentTargetId(transformNode.id, kRealRootNodeId); |
| 427 |
| 456 // TODO(jaydasika): We shouldn't set ToScreeen and FromScreen of root | 428 // TODO(jaydasika): We shouldn't set ToScreeen and FromScreen of root |
| 457 // transform node here. They should be set while updating transform tree in | 429 // transform node here. They should be set while updating transform tree in |
| 458 // cc. | 430 // cc. |
| 431 float deviceScaleFactor = m_rootLayer->GetLayerTree()->device_scale_factor(); |
| 459 gfx::Transform toScreen; | 432 gfx::Transform toScreen; |
| 460 toScreen.Scale(deviceScaleFactor, deviceScaleFactor); | 433 toScreen.Scale(deviceScaleFactor, deviceScaleFactor); |
| 461 transformTree().SetToScreen(kRealRootNodeId, toScreen); | 434 transformTree.SetToScreen(kRealRootNodeId, toScreen); |
| 462 gfx::Transform fromScreen; | 435 gfx::Transform fromScreen; |
| 463 bool invertible = toScreen.GetInverse(&fromScreen); | 436 bool invertible = toScreen.GetInverse(&fromScreen); |
| 464 DCHECK(invertible); | 437 DCHECK(invertible); |
| 465 transformTree().SetFromScreen(kRealRootNodeId, fromScreen); | 438 transformTree.SetFromScreen(kRealRootNodeId, fromScreen); |
| 466 transformTree().set_needs_update(true); | 439 transformTree.set_needs_update(true); |
| 440 |
| 441 m_transformNodeMap.set(TransformPaintPropertyNode::root(), transformNode.id); |
| 442 m_rootLayer->SetTransformTreeIndex(transformNode.id); |
| 443 } |
| 444 |
| 445 void PropertyTreeManager::setupRootClipNode() { |
| 446 // cc is hardcoded to use clip node index 1 for viewport clip. |
| 447 cc::ClipTree& clipTree = m_propertyTrees.clip_tree; |
| 448 clipTree.clear(); |
| 449 cc::ClipNode& clipNode = |
| 450 *clipTree.Node(clipTree.Insert(cc::ClipNode(), kRealRootNodeId)); |
| 451 DCHECK_EQ(clipNode.id, kSecondaryRootNodeId); |
| 452 |
| 453 clipNode.resets_clip = true; |
| 454 clipNode.owner_id = m_rootLayer->id(); |
| 455 clipNode.clip_type = cc::ClipNode::ClipType::APPLIES_LOCAL_CLIP; |
| 456 clipNode.clip = gfx::RectF( |
| 457 gfx::SizeF(m_rootLayer->GetLayerTree()->device_viewport_size())); |
| 458 clipNode.transform_id = kRealRootNodeId; |
| 459 clipNode.target_transform_id = kRealRootNodeId; |
| 460 |
| 461 m_clipNodeMap.set(ClipPaintPropertyNode::root(), clipNode.id); |
| 462 m_rootLayer->SetClipTreeIndex(clipNode.id); |
| 463 } |
| 464 |
| 465 void PropertyTreeManager::setupRootEffectNode() { |
| 466 // cc is hardcoded to use effect node index 1 for root render surface. |
| 467 cc::EffectTree& effectTree = m_propertyTrees.effect_tree; |
| 468 effectTree.clear(); |
| 469 cc::EffectNode& effectNode = |
| 470 *effectTree.Node(effectTree.Insert(cc::EffectNode(), kInvalidNodeId)); |
| 471 DCHECK_EQ(effectNode.id, kSecondaryRootNodeId); |
| 472 effectNode.owner_id = m_rootLayer->id(); |
| 473 effectNode.transform_id = kRealRootNodeId; |
| 474 effectNode.clip_id = kSecondaryRootNodeId; |
| 475 effectNode.has_render_surface = true; |
| 476 |
| 477 m_effectStack.append( |
| 478 BlinkEffectAndCcIdPair{EffectPaintPropertyNode::root(), effectNode.id}); |
| 479 m_rootLayer->SetEffectTreeIndex(effectNode.id); |
| 480 } |
| 481 |
| 482 void PropertyTreeManager::setupRootScrollNode() { |
| 483 cc::ScrollTree& scrollTree = m_propertyTrees.scroll_tree; |
| 484 scrollTree.clear(); |
| 485 cc::ScrollNode& scrollNode = |
| 486 *scrollTree.Node(scrollTree.Insert(cc::ScrollNode(), kRealRootNodeId)); |
| 487 DCHECK_EQ(scrollNode.id, kSecondaryRootNodeId); |
| 488 scrollNode.owner_id = m_rootLayer->id(); |
| 489 scrollNode.transform_id = kSecondaryRootNodeId; |
| 490 |
| 491 m_scrollNodeMap.set(ScrollPaintPropertyNode::root(), scrollNode.id); |
| 492 m_rootLayer->SetScrollTreeIndex(scrollNode.id); |
| 467 } | 493 } |
| 468 | 494 |
| 469 int PropertyTreeManager::compositorIdForTransformNode( | 495 int PropertyTreeManager::compositorIdForTransformNode( |
| 470 const TransformPaintPropertyNode* transformNode) { | 496 const TransformPaintPropertyNode* transformNode) { |
| 497 DCHECK(transformNode); |
| 498 // TODO(crbug.com/645615): Remove the failsafe here. |
| 471 if (!transformNode) | 499 if (!transformNode) |
| 472 return kSecondaryRootNodeId; | 500 return kSecondaryRootNodeId; |
| 473 | 501 |
| 474 auto it = m_transformNodeMap.find(transformNode); | 502 auto it = m_transformNodeMap.find(transformNode); |
| 475 if (it != m_transformNodeMap.end()) | 503 if (it != m_transformNodeMap.end()) |
| 476 return it->value; | 504 return it->value; |
| 477 | 505 |
| 478 scoped_refptr<cc::Layer> dummyLayer = cc::Layer::Create(); | 506 scoped_refptr<cc::Layer> dummyLayer = cc::Layer::Create(); |
| 479 int parentId = compositorIdForTransformNode(transformNode->parent()); | 507 int parentId = compositorIdForTransformNode(transformNode->parent()); |
| 480 int id = transformTree().Insert(cc::TransformNode(), parentId); | 508 int id = transformTree().Insert(cc::TransformNode(), parentId); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 504 dummyLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber); | 532 dummyLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber); |
| 505 | 533 |
| 506 auto result = m_transformNodeMap.set(transformNode, id); | 534 auto result = m_transformNodeMap.set(transformNode, id); |
| 507 DCHECK(result.isNewEntry); | 535 DCHECK(result.isNewEntry); |
| 508 transformTree().set_needs_update(true); | 536 transformTree().set_needs_update(true); |
| 509 return id; | 537 return id; |
| 510 } | 538 } |
| 511 | 539 |
| 512 int PropertyTreeManager::compositorIdForClipNode( | 540 int PropertyTreeManager::compositorIdForClipNode( |
| 513 const ClipPaintPropertyNode* clipNode) { | 541 const ClipPaintPropertyNode* clipNode) { |
| 542 DCHECK(clipNode); |
| 543 // TODO(crbug.com/645615): Remove the failsafe here. |
| 514 if (!clipNode) | 544 if (!clipNode) |
| 515 return kSecondaryRootNodeId; | 545 return kSecondaryRootNodeId; |
| 516 | 546 |
| 517 auto it = m_clipNodeMap.find(clipNode); | 547 auto it = m_clipNodeMap.find(clipNode); |
| 518 if (it != m_clipNodeMap.end()) | 548 if (it != m_clipNodeMap.end()) |
| 519 return it->value; | 549 return it->value; |
| 520 | 550 |
| 521 scoped_refptr<cc::Layer> dummyLayer = cc::Layer::Create(); | 551 scoped_refptr<cc::Layer> dummyLayer = cc::Layer::Create(); |
| 522 int parentId = compositorIdForClipNode(clipNode->parent()); | 552 int parentId = compositorIdForClipNode(clipNode->parent()); |
| 523 int id = clipTree().Insert(cc::ClipNode(), parentId); | 553 int id = clipTree().Insert(cc::ClipNode(), parentId); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 543 dummyLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber); | 573 dummyLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber); |
| 544 | 574 |
| 545 auto result = m_clipNodeMap.set(clipNode, id); | 575 auto result = m_clipNodeMap.set(clipNode, id); |
| 546 DCHECK(result.isNewEntry); | 576 DCHECK(result.isNewEntry); |
| 547 clipTree().set_needs_update(true); | 577 clipTree().set_needs_update(true); |
| 548 return id; | 578 return id; |
| 549 } | 579 } |
| 550 | 580 |
| 551 int PropertyTreeManager::compositorIdForScrollNode( | 581 int PropertyTreeManager::compositorIdForScrollNode( |
| 552 const ScrollPaintPropertyNode* scrollNode) { | 582 const ScrollPaintPropertyNode* scrollNode) { |
| 583 DCHECK(scrollNode); |
| 584 // TODO(crbug.com/645615): Remove the failsafe here. |
| 553 if (!scrollNode) | 585 if (!scrollNode) |
| 554 return kSecondaryRootNodeId; | 586 return kSecondaryRootNodeId; |
| 555 | 587 |
| 556 auto it = m_scrollNodeMap.find(scrollNode); | 588 auto it = m_scrollNodeMap.find(scrollNode); |
| 557 if (it != m_scrollNodeMap.end()) | 589 if (it != m_scrollNodeMap.end()) |
| 558 return it->value; | 590 return it->value; |
| 559 | 591 |
| 560 int parentId = compositorIdForScrollNode(scrollNode->parent()); | 592 int parentId = compositorIdForScrollNode(scrollNode->parent()); |
| 561 int id = scrollTree().Insert(cc::ScrollNode(), parentId); | 593 int id = scrollTree().Insert(cc::ScrollNode(), parentId); |
| 562 | 594 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 nodeA = nodeA->parent(); | 664 nodeA = nodeA->parent(); |
| 633 nodeB = nodeB->parent(); | 665 nodeB = nodeB->parent(); |
| 634 } | 666 } |
| 635 return nodeA; | 667 return nodeA; |
| 636 } | 668 } |
| 637 | 669 |
| 638 int PropertyTreeManager::switchToEffectNode( | 670 int PropertyTreeManager::switchToEffectNode( |
| 639 const EffectPaintPropertyNode& nextEffect) { | 671 const EffectPaintPropertyNode& nextEffect) { |
| 640 const EffectPaintPropertyNode* ancestor = | 672 const EffectPaintPropertyNode* ancestor = |
| 641 lowestCommonAncestor(currentEffectNode(), &nextEffect); | 673 lowestCommonAncestor(currentEffectNode(), &nextEffect); |
| 674 DCHECK(ancestor) << "Malformed effect tree. All nodes must be descendant of " |
| 675 "EffectPaintPropertyNode::root()."; |
| 642 while (currentEffectNode() != ancestor) | 676 while (currentEffectNode() != ancestor) |
| 643 m_effectStack.pop_back(); | 677 m_effectStack.pop_back(); |
| 644 | 678 |
| 645 #if DCHECK_IS_ON() | |
| 646 DCHECK(m_isFirstEffectEver || currentEffectNode()) | |
| 647 << "Malformed effect tree. Nodes in the same property tree should have " | |
| 648 "common root. " | |
| 649 << &nextEffect; | |
| 650 m_isFirstEffectEver = false; | |
| 651 #endif | |
| 652 | |
| 653 // Now the current effect is the lowest common ancestor of previous effect | 679 // Now the current effect is the lowest common ancestor of previous effect |
| 654 // and the next effect. That implies it is an existing node that already has | 680 // and the next effect. That implies it is an existing node that already has |
| 655 // at least one paint chunk or child effect, and we are going to either attach | 681 // at least one paint chunk or child effect, and we are going to either attach |
| 656 // another paint chunk or child effect to it. We can no longer omit render | 682 // another paint chunk or child effect to it. We can no longer omit render |
| 657 // surface for it even for opacity-only nodes. | 683 // surface for it even for opacity-only nodes. |
| 658 // See comments in PropertyTreeManager::buildEffectNodesRecursively(). | 684 // See comments in PropertyTreeManager::buildEffectNodesRecursively(). |
| 659 // TODO(crbug.com/504464): Remove premature optimization here. | 685 // TODO(crbug.com/504464): Remove premature optimization here. |
| 660 if (currentEffectNode() && currentEffectNode()->opacity() != 1.f) { | 686 if (currentEffectNode() && currentEffectNode()->opacity() != 1.f) { |
| 661 effectTree().Node(compositorIdForCurrentEffectNode())->has_render_surface = | 687 effectTree().Node(compositorIdForCurrentEffectNode())->has_render_surface = |
| 662 true; | 688 true; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 cc::LayerTree* layerTree = m_rootLayer->GetLayerTree(); | 757 cc::LayerTree* layerTree = m_rootLayer->GetLayerTree(); |
| 732 | 758 |
| 733 // The tree will be null after detaching and this update can be ignored. | 759 // The tree will be null after detaching and this update can be ignored. |
| 734 // See: WebViewImpl::detachPaintArtifactCompositor(). | 760 // See: WebViewImpl::detachPaintArtifactCompositor(). |
| 735 if (!layerTree) | 761 if (!layerTree) |
| 736 return; | 762 return; |
| 737 | 763 |
| 738 if (m_extraDataForTestingEnabled) | 764 if (m_extraDataForTestingEnabled) |
| 739 m_extraDataForTesting = wrapUnique(new ExtraDataForTesting); | 765 m_extraDataForTesting = wrapUnique(new ExtraDataForTesting); |
| 740 | 766 |
| 741 setMinimalPropertyTrees(layerTree->property_trees(), m_rootLayer->id()); | |
| 742 | |
| 743 m_rootLayer->RemoveAllChildren(); | 767 m_rootLayer->RemoveAllChildren(); |
| 744 m_rootLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber); | 768 m_rootLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber); |
| 745 m_rootLayer->SetTransformTreeIndex(kSecondaryRootNodeId); | |
| 746 m_rootLayer->SetClipTreeIndex(kSecondaryRootNodeId); | |
| 747 m_rootLayer->SetEffectTreeIndex(kSecondaryRootNodeId); | |
| 748 m_rootLayer->SetScrollTreeIndex(kRealRootNodeId); | |
| 749 | 769 |
| 750 PropertyTreeManager propertyTreeManager(*layerTree->property_trees(), | 770 PropertyTreeManager propertyTreeManager(*layerTree->property_trees(), |
| 751 m_rootLayer.get()); | 771 m_rootLayer.get()); |
| 752 propertyTreeManager.setDeviceScaleFactor(layerTree->device_scale_factor()); | |
| 753 | 772 |
| 754 Vector<std::unique_ptr<ContentLayerClientImpl>> newContentLayerClients; | 773 Vector<std::unique_ptr<ContentLayerClientImpl>> newContentLayerClients; |
| 755 newContentLayerClients.reserveCapacity(paintArtifact.paintChunks().size()); | 774 newContentLayerClients.reserveCapacity(paintArtifact.paintChunks().size()); |
| 756 for (const PaintChunk& paintChunk : paintArtifact.paintChunks()) { | 775 for (const PaintChunk& paintChunk : paintArtifact.paintChunks()) { |
| 757 gfx::Vector2dF layerOffset; | 776 gfx::Vector2dF layerOffset; |
| 758 scoped_refptr<cc::Layer> layer = layerForPaintChunk( | 777 scoped_refptr<cc::Layer> layer = layerForPaintChunk( |
| 759 paintArtifact, paintChunk, layerOffset, newContentLayerClients, | 778 paintArtifact, paintChunk, layerOffset, newContentLayerClients, |
| 760 rasterChunkInvalidations ? rasterChunkInvalidations->find(&paintChunk) | 779 rasterChunkInvalidations ? rasterChunkInvalidations->find(&paintChunk) |
| 761 : nullptr); | 780 : nullptr); |
| 762 | 781 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 m_contentLayerClients.clear(); | 814 m_contentLayerClients.clear(); |
| 796 m_contentLayerClients.swap(newContentLayerClients); | 815 m_contentLayerClients.swap(newContentLayerClients); |
| 797 | 816 |
| 798 // Mark the property trees as having been rebuilt. | 817 // Mark the property trees as having been rebuilt. |
| 799 layerTree->property_trees()->sequence_number = kPropertyTreeSequenceNumber; | 818 layerTree->property_trees()->sequence_number = kPropertyTreeSequenceNumber; |
| 800 layerTree->property_trees()->needs_rebuild = false; | 819 layerTree->property_trees()->needs_rebuild = false; |
| 801 layerTree->property_trees()->ResetCachedData(); | 820 layerTree->property_trees()->ResetCachedData(); |
| 802 } | 821 } |
| 803 | 822 |
| 804 } // namespace blink | 823 } // namespace blink |
| OLD | NEW |