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

Unified Diff: cc/trees/property_tree_builder.cc

Issue 687873004: Introduce Property Trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wip-awoloszyn2
Patch Set: . Created 6 years, 1 month 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
« no previous file with comments | « cc/trees/property_tree.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree_builder.cc
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
index 23299211fa6138631559290c0dca4dcab1629d39..379cda3e16f543daed05925b0277715140fd0604 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -4,8 +4,8 @@
#include "cc/trees/property_tree_builder.h"
-#include <set>
#include <map>
+#include <set>
#include "cc/base/math_util.h"
#include "cc/layers/layer.h"
@@ -18,68 +18,33 @@ class LayerTreeHost;
namespace {
-// For convenience, we'll use a pointery data structure while we're building
-// the property trees (since we won't necessarily be visiting the nodes in
-// order and this will make for faster insertions). We'll flatten these pointery
-// trees later. Eventually cc clients could produce flattened trees directly
-// obviating this step.
-template <typename T>
-struct UnflattenedTreeNode {
- scoped_ptr<T> data;
- // There could be costs assoc'd with copying here if the trees get big, but we
- // don't think that they will.
- ScopedPtrVector<UnflattenedTreeNode<T>> descendants;
+struct ClipAncestorData {
+ int node_id;
+ Layer* layer;
};
-typedef UnflattenedTreeNode<OpacityTreeNode> UnflattenedOpacityNode;
-typedef UnflattenedTreeNode<TransformTreeNode> UnflattenedTransformNode;
-typedef UnflattenedTreeNode<ClipTreeNode> UnflattenedClipNode;
-
struct DataForRecursion {
- UnflattenedOpacityNode* opacity_tree_parent;
- UnflattenedTransformNode* transform_tree_parent;
- UnflattenedTransformNode* transform_fixed_parent;
- std::vector<UnflattenedClipNode*> clip_ancestors;
+ TransformTree* transform_tree;
+ ClipTree* clip_tree;
+ OpacityTree* opacity_tree;
+ int transform_tree_parent;
+ int transform_fixed_parent;
+ int opacity_tree_parent;
+ std::vector<ClipAncestorData> clip_ancestors;
gfx::Vector2dF offset_to_transform_parent;
+ // TODO(vollick): is this used?
gfx::Vector2dF offset_to_fixed_parent;
const Layer* page_scale_layer;
float page_scale_factor;
float device_scale_factor;
};
-template <typename T>
-void SetIndexForLayer(Layer* layer, int index) {
- CHECK(false); // We should not be getting here
-}
-
-template <>
-void SetIndexForLayer<OpacityTreeNode>(Layer* layer, int index) {
- layer->set_opacity_tree_index(index);
-}
-template <>
-void SetIndexForLayer<ClipTreeNode>(Layer* layer, int index) {
- layer->set_clip_tree_index(index);
-}
-
-template <>
-void SetIndexForLayer<TransformTreeNode>(Layer* layer, int index) {
- layer->set_transform_tree_index(index);
-}
-
-template <typename T>
-void AssignLayerIndex(Layer* layer, int current_index, T* tree) {
- CHECK(false); // We should not be getting here
-}
-
-template <>
-void AssignLayerIndex<OpacityTree>(Layer* layer,
- int current_index,
- OpacityTree* opacity_tree) {
- if (opacity_tree->Node(current_index)->layer == layer) {
- SetIndexForLayer<OpacityTreeNode>(layer, current_index);
- return;
- }
- layer->set_opacity_tree_index(current_index);
+// Sad trombone.
+static void UnassignLayersToTree(Layer* layer) {
+ layer->set_clip_tree_index(-1);
+ layer->set_transform_tree_index(-1);
+ for (size_t i = 0; i < layer->children().size(); ++i)
+ UnassignLayersToTree(layer->children()[i].get());
}
// Computes the 2d translation from descendant space to ancestor space, assuming
@@ -93,133 +58,39 @@ gfx::Vector2dF ComputeTranslation(const Layer* ancestor,
gfx::Vector2dF accumulated_translation;
for (const Layer* current_layer = descendant; current_layer != ancestor;
current_layer = current_layer->parent()) {
- //TODO(awoloszyn) This fires from time to time. Figure out why this
- // happening, and whether or not this should be a valid DCHECK
- /*DCHECK_EQ(gfx::Vector2dF().ToString(),
- current_layer->TotalScrollOffset().ToString());*/
- accumulated_translation -= gfx::Vector2dF(current_layer->TotalScrollOffset().x(), current_layer->TotalScrollOffset().y());
+ // TODO(awoloszyn) This fires from time to time. Figure out why this
+ // happening, and whether or not this should be a valid DCHECK
+ // DCHECK_EQ(gfx::Vector2dF().ToString(),
+ // current_layer->TotalScrollOffset().ToString());
+ accumulated_translation -=
+ gfx::Vector2dF(current_layer->TotalScrollOffset().x(),
+ current_layer->TotalScrollOffset().y());
accumulated_translation += (current_layer->position() - gfx::PointF()) +
current_layer->transform().To2dTranslation();
}
return accumulated_translation;
}
-template <>
-void AssignLayerIndex<TransformTree>(Layer* layer,
- int current_index,
- TransformTree* transform_tree) {
- if (transform_tree->Node(current_index)->layer == layer) {
- SetIndexForLayer<TransformTreeNode>(layer, current_index);
- return;
- }
- // TODO(ajuma): Compute offset_to_parent for the scroll_parent and clip_parent
- // cases during the earlier tree walk rather than here.
- if (layer->position_constraint().is_fixed_position()) {
- layer->set_transform_tree_index(
- layer->fixed_position_container()->transform_tree_index());
- } else if (layer->scroll_parent()) {
- layer->set_transform_tree_index(
- layer->scroll_parent()->transform_tree_index());
- } else {
- layer->set_transform_tree_index(layer->parent()->transform_tree_index());
- if (layer->clip_parent()) {
- layer->set_offset_to_transform_parent(ComputeTranslation(
- transform_tree->Node(layer->transform_tree_index())->layer, layer));
- }
- }
- DCHECK_LT(-1, layer->transform_tree_index());
-}
-
-template <>
-void AssignLayerIndex<ClipTree>(Layer* layer,
- int current_index,
- ClipTree* clip_tree) {
- if (clip_tree->Node(current_index)->layer == layer) {
- SetIndexForLayer<ClipTreeNode>(layer, current_index);
- return;
- }
- if (layer->scroll_parent()) {
- layer->set_clip_tree_index(layer->scroll_parent()->clip_tree_index());
- } else if (layer->clip_parent()) {
- layer->set_clip_tree_index(layer->clip_parent()->clip_tree_index());
- } else {
- layer->set_clip_tree_index(layer->parent()->clip_tree_index());
- }
- DCHECK_LT(-1, layer->clip_tree_index());
-}
-
-struct FlatteningData {
- Layer* layer;
- UnflattenedOpacityNode* opacity_node;
- UnflattenedTransformNode* transform_node;
- UnflattenedClipNode* clip_node;
-};
-
-//TODO(awoloszyn) This is currently WIP for fixing the fixed element
-// with clip parent. May not stay.
+// TODO(awoloszyn): This is currently WIP for fixing the fixed element with clip
+// parent. May not stay.
struct SupplementalData {
Layer* layer;
gfx::Vector2dF offset_from_fixed_parent;
};
-void AssignLayersToTree(ClipTree* clip_tree,
- TransformTree* transform_tree,
- OpacityTree* opacity_tree,
- std::vector<FlatteningData>* flattening_data) {
- for(FlatteningData& data: *flattening_data) {
- AssignLayerIndex(data.layer, data.clip_node->data->id, clip_tree);
- AssignLayerIndex(data.layer, data.transform_node->data->id, transform_tree);
- AssignLayerIndex(data.layer, data.opacity_node->data->id, opacity_tree);
- }
-}
-
-template <typename T>
-void FlattenTreeInternal(UnflattenedTreeNode<T>* unflattened_tree,
- PropertyTree<T>* flattened_tree,
- int parent_id) {
- int currentIndex =
- flattened_tree->InsertWithParent(*unflattened_tree->data, parent_id);
- unflattened_tree->data->id = currentIndex;
-
- for (size_t i = 0; i < unflattened_tree->descendants.size(); ++i) {
- FlattenTreeInternal(
- unflattened_tree->descendants[i], flattened_tree, currentIndex);
- }
-}
-
-template <typename T>
-void FlattenTree(UnflattenedTreeNode<T>* unflattened_tree,
- PropertyTree<T>* flattened_tree) {
- int root_idx = flattened_tree->InsertRootNode(*unflattened_tree->data);
- unflattened_tree->data->id = root_idx;
- for (size_t i = 0; i < unflattened_tree->descendants.size(); ++i) {
- FlattenTreeInternal(
- unflattened_tree->descendants[i], flattened_tree, root_idx);
- }
-}
-
-UnflattenedTransformNode* GetTransformParent(
+static TransformNode* GetTransformParent(
const DataForRecursion& data_for_recursion,
Layer* layer) {
if (layer->position_constraint().is_fixed_position())
- return data_for_recursion.transform_fixed_parent;
- return data_for_recursion.transform_tree_parent;
+ return data_for_recursion.transform_tree->Node(
+ data_for_recursion.transform_fixed_parent);
+ return data_for_recursion.transform_tree->Node(
+ data_for_recursion.transform_tree_parent);
}
-bool RequiresClipNode(Layer* layer) {
- if (!layer->parent()) {
- return true;
- }
- if(layer->masks_to_bounds()) {
- return true;
- }
- if (layer->mask_layer()) {
- return true;
- }
- if (layer->render_surface()) {
- return true;
- }
- return false;
+static bool RequiresClipNode(Layer* layer) {
+ return !layer->parent() || layer->masks_to_bounds() || layer->mask_layer() ||
+ layer->render_surface();
}
bool Clips(Layer* layer) {
@@ -244,19 +115,25 @@ Layer* ClipNodeAncestor(Layer* layer) {
return ClipNodeAncestor(clip_ancestor);
}
-UnflattenedClipNode* GetClipParent(const DataForRecursion& data_for_recursion,
- Layer* layer) {
- if (!layer->clip_parent())
- return data_for_recursion.clip_ancestors.back();
+static ClipNode* GetClipParent(const DataForRecursion& data_for_recursion,
+ Layer* layer) {
+ if (!layer->parent() || !layer->clip_parent()) {
+ fprintf(stderr, "aoeu id --> %d\n",
+ data_for_recursion.clip_ancestors.back().node_id);
+ return data_for_recursion.clip_tree->Node(
+ data_for_recursion.clip_ancestors.back().node_id);
+ }
+
Layer* clip_node_ancestor = ClipNodeAncestor(layer->clip_parent());
- std::vector<UnflattenedClipNode*>::const_reverse_iterator iter =
+ fprintf(stderr, "looking for clip parent %p\n", clip_node_ancestor);
+ std::vector<ClipAncestorData>::const_reverse_iterator iter =
data_for_recursion.clip_ancestors.rbegin();
for (; iter != data_for_recursion.clip_ancestors.rend(); ++iter) {
- if ((*iter)->data->layer == clip_node_ancestor)
+ if (iter->layer == clip_node_ancestor)
break;
}
DCHECK(iter != data_for_recursion.clip_ancestors.rend());
- return *iter;
+ return data_for_recursion.clip_tree->Node(iter->node_id);
}
void AddOpacityNodeIfNeeded(const DataForRecursion& data_from_ancestor,
@@ -265,34 +142,39 @@ void AddOpacityNodeIfNeeded(const DataForRecursion& data_from_ancestor,
if (layer->parent() && layer->opacity() == 1.0)
return;
- UnflattenedOpacityNode* node = data_from_ancestor.opacity_tree_parent;
if (layer->parent()) {
- data_from_ancestor.opacity_tree_parent->descendants.push_back(
- scoped_ptr<UnflattenedOpacityNode>(new UnflattenedOpacityNode()));
- node = data_from_ancestor.opacity_tree_parent->descendants.back();
- data_for_children->opacity_tree_parent = node;
+ data_for_children->opacity_tree_parent =
+ data_from_ancestor.opacity_tree->InsertWithParent(
+ OpacityNode(layer, layer->opacity()),
+ data_from_ancestor.opacity_tree_parent);
}
-
- node->data.reset(new OpacityTreeNode(layer, layer->opacity()));
}
void AddClipNodeIfNeeded(const DataForRecursion& data_from_ancestor,
Layer* layer,
DataForRecursion* data_for_children) {
- if (!RequiresClipNode(layer))
+ ClipNode* parent = GetClipParent(data_from_ancestor, layer);
+ if (!RequiresClipNode(layer)) {
+ layer->set_clip_tree_index(parent->id);
+// if (layer->scroll_parent()) {
+// layer->set_clip_tree_index(layer->scroll_parent()->clip_tree_index());
+// } else if (layer->clip_parent()) {
+// layer->set_clip_tree_index(layer->clip_parent()->clip_tree_index());
+// } else {
+// layer->set_clip_tree_index(layer->parent()->clip_tree_index());
+// }
return;
+ }
- UnflattenedClipNode* node = data_from_ancestor.clip_ancestors.back();
+ // TODO(vollick): we should add the node for the parent here..
if (layer->parent()) {
- UnflattenedClipNode* parent = GetClipParent(data_from_ancestor, layer);
- parent->descendants.push_back(
- scoped_ptr<UnflattenedClipNode>(new UnflattenedClipNode()));
- node = parent->descendants.back();
- data_for_children->clip_ancestors.push_back(node);
+ ClipAncestorData clip_ancestor_data;
+ clip_ancestor_data.node_id = data_for_children->clip_tree->InsertWithParent(
+ ClipNode(layer, gfx::RectF(layer->bounds()), Clips(layer)), parent->id);
+ clip_ancestor_data.layer = layer;
+ data_for_children->clip_ancestors.push_back(clip_ancestor_data);
}
- node->data.reset(new ClipTreeNode(layer, gfx::RectF(layer->bounds()),
- Clips(layer)));
// TODO(awoloszyn): Right now when we hit a node with a replica, we
// reset the clip for all children since we may need to draw. We
// need to figure out a better way, since we will need both the
@@ -321,24 +203,28 @@ void AddTransformNodeIfNeeded(const DataForRecursion& data_from_ancestor,
has_animated_transform || is_page_scale_application_layer;
if (!requires_transform_node) {
-// DCHECK_EQ(gfx::Vector2dF().ToString(),
- // layer->TotalScrollOffset().ToString());
- // TODO(vollick): it's a little silly we have to jump through these hoops to
- // get a vector from a point. Surely there's a better way.
+ // TODO(vollick): This can be drastrically simplified if we don't have an
+ // unflattened tree. We should be able to grab the transform parent
+ // immediately and then compute an offset to it in a helper that can account
+ // for scroll parents, fixed pos, etc. Leaving the logic here like this
+ // temporarily while I convert away from unflattened trees.
data_for_children->offset_to_transform_parent +=
- (layer->position() - gfx::PointF()) +
+ layer->position().OffsetFromOrigin() +
awoloszyn 2014/11/12 19:38:59 That is way nicer.
layer->transform().To2dTranslation();
if (layer->IsContainerForFixedPositionLayers()) {
data_for_children->transform_fixed_parent =
- GetTransformParent(data_from_ancestor, layer);
+ GetTransformParent(data_from_ancestor, layer)->id;
}
data_for_children->offset_to_fixed_parent =
data_from_ancestor.offset_to_fixed_parent;
if(layer->scroll_parent()) {
- gfx::Vector2dF offset_from_transform_parent_to_parent = ComputeTranslation(
- layer->parent(),
- data_from_ancestor.transform_tree_parent->data->layer);
+ gfx::Vector2dF offset_from_transform_parent_to_parent =
+ ComputeTranslation(
+ layer->parent(),
+ data_from_ancestor.transform_tree
+ ->Node(data_from_ancestor.transform_tree_parent)
+ ->layer);
gfx::Vector2dF offset_to_parent =
ComputeTranslation(layer->parent(), layer);
layer->set_offset_to_transform_parent(
@@ -348,45 +234,41 @@ void AddTransformNodeIfNeeded(const DataForRecursion& data_from_ancestor,
layer->set_offset_to_transform_parent(
data_for_children->offset_to_transform_parent);
}
+
+ TransformNode* transform_parent =
+ GetTransformParent(data_from_ancestor, layer);
awoloszyn 2014/11/12 19:38:59 GetTransformParent does not take into account scro
+
+ layer->set_transform_tree_index(transform_parent->id);
+
+ // TODO(vollick): see note above.
+ if (!is_fixed && !layer->scroll_parent() && layer->clip_parent()) {
+ if (layer->clip_parent()) {
awoloszyn 2014/11/12 19:38:59 This line is redundant.
+ layer->set_offset_to_transform_parent(
+ ComputeTranslation(data_from_ancestor.transform_tree
+ ->Node(layer->transform_tree_index())
+ ->layer,
+ layer));
+ }
+ }
+
return;
}
if (is_fixed) {
layer->set_fixed_position_container(
- GetTransformParent(data_from_ancestor, layer)->data->layer);
+ GetTransformParent(data_from_ancestor, layer)->layer);
} else {
layer->set_fixed_position_container(NULL);
}
- UnflattenedTransformNode* node = data_from_ancestor.transform_tree_parent;
- if (layer->parent()) {
- UnflattenedTransformNode* parent =
- GetTransformParent(data_from_ancestor, layer);
- parent->descendants.push_back(
- scoped_ptr<UnflattenedTransformNode>(new UnflattenedTransformNode()));
- node = parent->descendants.back();
- }
-
- if (layer->IsContainerForFixedPositionLayers()) {
- data_for_children->transform_fixed_parent = node;
- data_for_children->offset_to_fixed_parent = gfx::Vector2dF();
- } else {
- data_for_children->offset_to_fixed_parent +=
- data_for_children->offset_to_transform_parent;
- }
-
- data_for_children->transform_tree_parent = node;
- data_for_children->offset_to_transform_parent = gfx::Vector2dF();
- layer->set_offset_to_transform_parent(
- data_for_children->offset_to_transform_parent);
-
gfx::Vector2dF offset_to_transform_parent =
data_from_ancestor.offset_to_transform_parent;
if(layer->scroll_parent()) {
gfx::Vector2dF offset_from_transform_parent_to_parent = ComputeTranslation(
- layer->parent(),
- data_from_ancestor.transform_tree_parent->data->layer);
+ layer->parent(), data_from_ancestor.transform_tree
+ ->Node(data_from_ancestor.transform_tree_parent)
+ ->layer);
gfx::Vector2dF offset_to_parent =
ComputeTranslation(layer->parent(), layer);
layer->set_offset_to_transform_parent(
@@ -415,12 +297,9 @@ void AddTransformNodeIfNeeded(const DataForRecursion& data_from_ancestor,
// record, the slight difference should be inconsequential).
gfx::Vector2dF position = layer->position() - gfx::PointF();
if (!layer->scroll_parent()) {
- position -= gfx::Vector2dF(layer->TotalScrollOffset().x(),
- layer->TotalScrollOffset().y());
+ position -= gfx::Vector2dF(layer->TotalScrollOffset().x(),
+ layer->TotalScrollOffset().y());
}
-// -
-// / gfx::PointF(layer->TotalScrollOffset().x(),
-// layer->TotalScrollOffset().y());
if (is_fixed) {
auto supplemental = supplemental_data->find(layer);
if (supplemental != supplemental_data->end()) {
@@ -430,7 +309,6 @@ void AddTransformNodeIfNeeded(const DataForRecursion& data_from_ancestor,
}
} else {
position += offset_to_transform_parent;
-
}
transform.Translate3d(position.x() + layer->transform_origin().x(),
position.y() + layer->transform_origin().y(),
@@ -440,24 +318,44 @@ void AddTransformNodeIfNeeded(const DataForRecursion& data_from_ancestor,
-layer->transform_origin().y(),
-layer->transform_origin().z());
- node->data.reset(new TransformTreeNode(layer, transform));
+ if (is_root) {
+ data_from_ancestor.transform_tree->root()->value = transform;
+ } else {
+ data_for_children->transform_tree_parent =
+ data_from_ancestor.transform_tree->InsertWithParent(
+ TransformNode(layer, transform),
+ GetTransformParent(data_from_ancestor, layer)->id);
+ }
+
+ if (layer->IsContainerForFixedPositionLayers() || is_root) {
+ data_for_children->transform_fixed_parent =
+ data_for_children->transform_tree_parent;
+ data_for_children->offset_to_fixed_parent = gfx::Vector2dF();
+ } else {
+ data_for_children->offset_to_fixed_parent +=
+ data_for_children->offset_to_transform_parent;
+ }
+
+ data_for_children->offset_to_transform_parent = gfx::Vector2dF();
+ layer->set_offset_to_transform_parent(gfx::Vector2dF());
+ layer->set_transform_tree_index(data_for_children->transform_tree_parent);
}
void BuildPropertyTreesInternal(Layer* layer,
const DataForRecursion& data_from_parent,
- std::vector<FlatteningData>* flattening_data,
std::map<Layer*, SupplementalData>* supplemental_data) {
DataForRecursion data_for_children(data_from_parent);
AddOpacityNodeIfNeeded(data_from_parent, layer, &data_for_children);
- AddClipNodeIfNeeded(data_from_parent, layer, &data_for_children);
AddTransformNodeIfNeeded(data_from_parent, layer, &data_for_children, supplemental_data);
+ layer->set_transform_tree_index(data_for_children.transform_tree_parent);
+
+ AddClipNodeIfNeeded(data_from_parent, layer, &data_for_children);
+ layer->set_clip_tree_index(data_for_children.clip_ancestors.back().node_id);
- flattening_data->push_back((FlatteningData){layer, data_for_children.opacity_tree_parent,
- data_for_children.transform_tree_parent,
- data_for_children.clip_ancestors.back()});
for (size_t i = 0; i < layer->children().size(); ++i) {
+ // TODO(vollick): this should read: if (!scroll child) { recur; }
if ((layer->children()[i]->scroll_parent() &&
layer->children()[i]->scroll_parent() != layer) ||
(!layer->children()[i]->scroll_parent() &&
@@ -470,37 +368,23 @@ void BuildPropertyTreesInternal(Layer* layer,
DCHECK(a.second);
continue;
}
- BuildPropertyTreesInternal(layer->children()[i].get(), data_for_children, flattening_data, supplemental_data);
+ BuildPropertyTreesInternal(layer->children()[i].get(), data_for_children, supplemental_data);
}
if (std::set<Layer*>* scroll_children = layer->scroll_children()) {
std::set<Layer*>::const_iterator iter = scroll_children->begin();
for (; iter != scroll_children->end(); ++iter)
- BuildPropertyTreesInternal(*iter, data_for_children, flattening_data, supplemental_data);
+ BuildPropertyTreesInternal(*iter, data_for_children, supplemental_data);
}
+ // TODO(vollick): we should be able to visit clip children during the "normal"
+ // recursion.
if (std::set<Layer*>* clip_children = layer->clip_children()) {
std::set<Layer*>::const_iterator iter = clip_children->begin();
for (; iter != clip_children->end(); ++iter)
- BuildPropertyTreesInternal(*iter, data_for_children, flattening_data, supplemental_data);
+ BuildPropertyTreesInternal(*iter, data_for_children, supplemental_data);
}
}
-template void FlattenTreeInternal(UnflattenedClipNode* unflattened_tree,
- ClipTree* flattened_tree,
- int parent_id);
-template void FlattenTreeInternal(UnflattenedOpacityNode* unflattened_tree,
- OpacityTree* flattened_tree,
- int parent_id);
-template void FlattenTreeInternal(UnflattenedTransformNode* unflattened_tree,
- TransformTree* flattened_tree,
- int parent_id);
-
-template void FlattenTree(UnflattenedClipNode* unflattened_tree,
- ClipTree* flattened_tree);
-template void FlattenTree(UnflattenedOpacityNode* unflattened_tree,
- OpacityTree* flattened_tree);
-template void FlattenTree(UnflattenedTransformNode* unflattened_tree,
- TransformTree* flattened_tree);
} // namespace
void PropertyTreeBuilder::BuildPropertyTrees(
@@ -513,32 +397,28 @@ void PropertyTreeBuilder::BuildPropertyTrees(
OpacityTree* opacity_tree,
TransformTree* transform_tree,
ClipTree* clip_tree) {
- std::vector<FlatteningData> flattening_data;
std::map<Layer*, SupplementalData> supplemental_data;
- UnflattenedOpacityNode unflattened_opacity_tree;
- UnflattenedTransformNode unflattened_transform_tree;
- UnflattenedClipNode unflattened_clip_tree;
DataForRecursion data_for_recursion;
- data_for_recursion.opacity_tree_parent = &unflattened_opacity_tree;
- data_for_recursion.transform_tree_parent = &unflattened_transform_tree;
- data_for_recursion.transform_fixed_parent = &unflattened_transform_tree;
- data_for_recursion.clip_ancestors.push_back(&unflattened_clip_tree);
+ data_for_recursion.transform_tree = transform_tree;
+ data_for_recursion.clip_tree = clip_tree;
+ data_for_recursion.opacity_tree = opacity_tree;
+ data_for_recursion.transform_tree_parent = 0;
+ data_for_recursion.transform_fixed_parent = 0;
data_for_recursion.page_scale_layer = page_scale_layer;
data_for_recursion.page_scale_factor = page_scale_factor;
data_for_recursion.device_scale_factor = device_scale_factor;
- BuildPropertyTreesInternal(root_layer, data_for_recursion, &flattening_data, &supplemental_data);
+ ClipAncestorData root_clip_data = { 0, root_layer };
+ data_for_recursion.clip_ancestors.push_back(root_clip_data);
+
+ BuildPropertyTreesInternal(root_layer, data_for_recursion, &supplemental_data);
- FlattenTree(&unflattened_opacity_tree, opacity_tree);
- FlattenTree(&unflattened_clip_tree, clip_tree);
- FlattenTree(&unflattened_transform_tree, transform_tree);
- AssignLayersToTree(clip_tree, transform_tree, opacity_tree, &flattening_data);
if (viewport.IsEmpty())
clip_tree->root()->clips = false;
-
+
gfx::RectF transformed_viewport;
gfx::Transform combined_transform = transform_tree->root()->value;
combined_transform.ConcatTransform(device_transform);
« no previous file with comments | « cc/trees/property_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698