summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/layers/delegated_renderer_layer_impl_unittest.cc12
-rw-r--r--cc/layers/layer.cc10
-rw-r--r--cc/layers/layer.h12
-rw-r--r--cc/layers/layer_impl.cc16
-rw-r--r--cc/layers/layer_impl.h12
-rw-r--r--cc/layers/layer_impl_unittest.cc8
-rw-r--r--cc/layers/layer_position_constraint_unittest.cc25
-rw-r--r--cc/layers/picture_layer_impl.cc3
-rw-r--r--cc/layers/render_surface_impl.cc3
-rw-r--r--cc/output/renderer_pixeltest.cc8
-rw-r--r--cc/output/software_renderer_unittest.cc9
-rw-r--r--cc/quads/draw_quad_unittest.cc8
-rw-r--r--cc/quads/render_pass_unittest.cc24
-rw-r--r--cc/quads/shared_quad_state.cc10
-rw-r--r--cc/quads/shared_quad_state.h4
-rw-r--r--cc/surfaces/surface_aggregator_test_helpers.cc6
-rw-r--r--cc/surfaces/surface_aggregator_unittest.cc3
-rw-r--r--cc/surfaces/surfaces_pixeltest.cc3
-rw-r--r--cc/test/layer_tree_host_common_test.h2
-rw-r--r--cc/test/layer_tree_json_parser.cc6
-rw-r--r--cc/test/render_pass_test_common.cc6
-rw-r--r--cc/test/render_pass_test_utils.cc22
-rw-r--r--cc/trees/layer_tree_host_common.cc10
-rw-r--r--cc/trees/layer_tree_host_common_perftest.cc2
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc12
-rw-r--r--cc/trees/layer_tree_host_impl.cc4
-rw-r--r--cc/trees/layer_tree_host_pixeltest_filters.cc8
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc6
-rw-r--r--cc/trees/occlusion_tracker.cc2
-rw-r--r--cc/trees/occlusion_tracker_unittest.cc22
-rw-r--r--content/common/cc_messages.h1
-rw-r--r--content/common/cc_messages_unittest.cc28
-rw-r--r--content/renderer/compositor_bindings/web_layer_impl.cc2
33 files changed, 188 insertions, 121 deletions
diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc
index fbaf8bbf..41c301a 100644
--- a/cc/layers/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
@@ -530,7 +530,8 @@ class DelegatedRendererLayerImplTestTransform
child_pass_clip_rect,
child_pass_clipped,
1.f,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<SolidColorDrawQuad> color_quad;
color_quad = SolidColorDrawQuad::Create();
@@ -570,7 +571,8 @@ class DelegatedRendererLayerImplTestTransform
root_pass_clip_rect,
root_pass_clipped,
1.f,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<RenderPassDrawQuad> render_pass_quad =
RenderPassDrawQuad::Create();
@@ -973,7 +975,8 @@ class DelegatedRendererLayerImplTestClip
child_pass_clip_rect,
child_pass_clipped,
1.f,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<SolidColorDrawQuad> color_quad;
color_quad = SolidColorDrawQuad::Create();
@@ -1011,7 +1014,8 @@ class DelegatedRendererLayerImplTestClip
root_pass_clip_rect,
root_pass_clipped,
1.f,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<RenderPassDrawQuad> render_pass_quad =
RenderPassDrawQuad::Create();
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 67664e0..e00d2c5 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -42,6 +42,7 @@ Layer::Layer()
// Layer IDs start from 1.
layer_id_(g_next_layer_id.GetNext() + 1),
ignore_set_needs_commit_(false),
+ sorting_context_id_(0),
parent_(NULL),
layer_tree_host_(NULL),
scroll_clip_layer_id_(INVALID_ID),
@@ -61,7 +62,6 @@ Layer::Layer()
use_parent_backface_visibility_(false),
draw_checkerboard_for_missing_tiles_(false),
force_render_surface_(false),
- is_3d_sorted_(false),
transform_is_invertible_(true),
background_color_(0),
opacity_(1.f),
@@ -756,11 +756,11 @@ void Layer::SetDoubleSided(bool double_sided) {
SetNeedsCommit();
}
-void Layer::SetIs3dSorted(bool sorted) {
+void Layer::Set3dSortingContextId(int id) {
DCHECK(IsPropertyChangeAllowed());
- if (is_3d_sorted_ == sorted)
+ if (id == sorting_context_id_)
return;
- is_3d_sorted_ = sorted;
+ sorting_context_id_ = id;
SetNeedsCommit();
}
@@ -894,11 +894,11 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
IsContainerForFixedPositionLayers());
layer->SetPositionConstraint(position_constraint_);
layer->SetShouldFlattenTransform(should_flatten_transform_);
- layer->SetIs3dSorted(is_3d_sorted_);
layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating())
layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly()));
+ layer->Set3dSortingContextId(sorting_context_id_);
layer->SetScrollClipLayer(scroll_clip_layer_id_);
layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index 9e94b53..ab897a8 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -320,8 +320,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
void SetShouldFlattenTransform(bool flatten);
bool should_flatten_transform() const { return should_flatten_transform_; }
- void SetIs3dSorted(bool sorted);
- bool is_3d_sorted() const { return is_3d_sorted_; }
+ bool Is3dSorted() const { return sorting_context_id_ != 0; }
void set_use_parent_backface_visibility(bool use) {
use_parent_backface_visibility_ = use;
@@ -458,6 +457,9 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
virtual void RunMicroBenchmark(MicroBenchmark* benchmark);
+ void Set3dSortingContextId(int id);
+ int sorting_context_id() const { return sorting_context_id_; }
+
protected:
friend class LayerImpl;
friend class TreeSynchronizer;
@@ -530,6 +532,11 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// will be handled implicitly after the update completes.
bool ignore_set_needs_commit_;
+ // Layers that share a sorting context id will be sorted together in 3d
+ // space. 0 is a special value that means this layer will not be sorted and
+ // will be drawn in paint order.
+ int sorting_context_id_;
+
private:
friend class base::RefCounted<Layer>;
@@ -588,7 +595,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
bool use_parent_backface_visibility_ : 1;
bool draw_checkerboard_for_missing_tiles_ : 1;
bool force_render_surface_ : 1;
- bool is_3d_sorted_ : 1;
bool transform_is_invertible_ : 1;
Region non_fast_scrollable_region_;
Region touch_event_handler_region_;
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 52a15ee..570616e 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -61,13 +61,13 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id)
force_render_surface_(false),
transform_is_invertible_(true),
is_container_for_fixed_position_layers_(false),
- is_3d_sorted_(false),
background_color_(0),
opacity_(1.0),
blend_mode_(SkXfermode::kSrcOver_Mode),
draw_depth_(0.f),
needs_push_properties_(false),
num_dependents_need_push_properties_(0),
+ sorting_context_id_(0),
current_draw_mode_(DRAW_MODE_NONE) {
DCHECK_GT(layer_id_, 0);
DCHECK(layer_tree_impl_);
@@ -248,7 +248,8 @@ void LayerImpl::PopulateSharedQuadState(SharedQuadState* state) const {
draw_properties_.clip_rect,
draw_properties_.is_clipped,
draw_properties_.opacity,
- blend_mode_);
+ blend_mode_,
+ sorting_context_id_);
}
bool LayerImpl::WillDraw(DrawMode draw_mode,
@@ -512,7 +513,6 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
is_container_for_fixed_position_layers_);
layer->SetPositionConstraint(position_constraint_);
layer->SetShouldFlattenTransform(should_flatten_transform_);
- layer->SetIs3dSorted(is_3d_sorted_);
layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
@@ -523,6 +523,7 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->SetScrollOffsetAndDelta(
scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta());
layer->SetSentScrollDelta(gfx::Vector2d());
+ layer->Set3dSortingContextId(sorting_context_id_);
LayerImpl* scroll_parent = NULL;
if (scroll_parent_) {
@@ -631,7 +632,7 @@ base::DictionaryValue* LayerImpl::LayerTreeAsJson() const {
result->Set("DrawTransform", list);
result->SetBoolean("DrawsContent", draws_content_);
- result->SetBoolean("Is3DSorted", is_3d_sorted_);
+ result->SetBoolean("Is3dSorted", Is3dSorted());
result->SetDouble("Opacity", opacity());
result->SetBoolean("ContentsOpaque", contents_opaque_);
@@ -974,11 +975,10 @@ void LayerImpl::SetShouldFlattenTransform(bool flatten) {
NoteLayerPropertyChangedForSubtree();
}
-void LayerImpl::SetIs3dSorted(bool sorted) {
- if (is_3d_sorted_ == sorted)
+void LayerImpl::Set3dSortingContextId(int id) {
+ if (id == sorting_context_id_)
return;
-
- is_3d_sorted_ = sorted;
+ sorting_context_id_ = id;
NoteLayerPropertyChangedForSubtree();
}
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index b93a504..299a741 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -267,8 +267,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
void SetShouldFlattenTransform(bool flatten);
bool should_flatten_transform() const { return should_flatten_transform_; }
- void SetIs3dSorted(bool sorted);
- bool is_3d_sorted() const { return is_3d_sorted_; }
+ bool Is3dSorted() const { return sorting_context_id_ != 0; }
void SetUseParentBackfaceVisibility(bool use) {
use_parent_backface_visibility_ = use;
@@ -531,6 +530,9 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
bool IsDrawnRenderSurfaceLayerListMember() const;
+ void Set3dSortingContextId(int id);
+ int sorting_context_id() { return sorting_context_id_; }
+
protected:
LayerImpl(LayerTreeImpl* layer_impl, int id);
@@ -618,7 +620,6 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
// Set for the layer that other layers are fixed to.
bool is_container_for_fixed_position_layers_ : 1;
- bool is_3d_sorted_ : 1;
Region non_fast_scrollable_region_;
Region touch_event_handler_region_;
SkColor background_color_;
@@ -653,6 +654,11 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
// active side.
int num_dependents_need_push_properties_;
+ // Layers that share a sorting context id will be sorted together in 3d
+ // space. 0 is a special value that means this layer will not be sorted and
+ // will be drawn in paint order.
+ int sorting_context_id_;
+
DrawMode current_draw_mode_;
private:
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 51939e4..281a3f1 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -155,7 +155,7 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
root->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 10)));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPosition(arbitrary_point_f));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetShouldFlattenTransform(false));
- EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetIs3dSorted(true));
+ EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->Set3dSortingContextId(1));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
root->SetDoubleSided(false)); // constructor initializes it to "true".
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d));
@@ -209,7 +209,7 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
root->SetPosition(arbitrary_point_f));
EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
root->SetShouldFlattenTransform(false));
- EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetIs3dSorted(true));
+ EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1));
EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
root->SetTransform(arbitrary_transform));
EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
@@ -303,7 +303,7 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
layer->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 5)));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetPosition(arbitrary_point_f));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetShouldFlattenTransform(false));
- VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetIs3dSorted(true));
+ VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
layer->SetDoubleSided(false)); // constructor initializes it to "true".
@@ -328,7 +328,7 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetPosition(arbitrary_point_f));
- VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetIs3dSorted(true));
+ VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
layer->SetDoubleSided(false)); // constructor initializes it to "true".
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
diff --git a/cc/layers/layer_position_constraint_unittest.cc b/cc/layers/layer_position_constraint_unittest.cc
index 269bc96..d9e1f64 100644
--- a/cc/layers/layer_position_constraint_unittest.cc
+++ b/cc/layers/layer_position_constraint_unittest.cc
@@ -22,14 +22,12 @@ void SetLayerPropertiesForTesting(LayerImpl* layer,
const gfx::Point3F& transform_origin,
const gfx::PointF& position,
const gfx::Size& bounds,
- bool flatten_transform,
- bool is_3d_sorted) {
+ bool flatten_transform) {
layer->SetTransform(transform);
layer->SetTransformOrigin(transform_origin);
layer->SetPosition(position);
layer->SetBounds(bounds);
layer->SetShouldFlattenTransform(flatten_transform);
- layer->SetIs3dSorted(is_3d_sorted);
layer->SetContentBounds(bounds);
}
@@ -96,29 +94,21 @@ class LayerPositionConstraintTest : public testing::Test {
transform_origin,
position,
bounds,
- true,
- false);
- SetLayerPropertiesForTesting(child.get(),
- IdentityMatrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ true);
+ SetLayerPropertiesForTesting(
+ child.get(), IdentityMatrix, transform_origin, position, bounds, true);
SetLayerPropertiesForTesting(grand_child.get(),
IdentityMatrix,
transform_origin,
position,
bounds,
- true,
- false);
+ true);
SetLayerPropertiesForTesting(great_grand_child.get(),
IdentityMatrix,
transform_origin,
position,
bounds,
- true,
- false);
+ true);
root->SetBounds(clip_bounds);
scroll_layer->SetScrollClipLayer(root->id());
@@ -744,8 +734,7 @@ TEST_F(LayerPositionConstraintTest,
gfx::Point3F(),
gfx::PointF(),
gfx::Size(100, 100),
- true,
- false);
+ true);
great_grand_child->AddChild(fixed_position_child.Pass());
}
LayerImpl* fixed_position_child = great_grand_child->children()[0];
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 0ebd0e4..d75ad8c 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -157,7 +157,8 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink,
draw_properties().clip_rect,
draw_properties().is_clipped,
draw_properties().opacity,
- blend_mode());
+ blend_mode(),
+ sorting_context_id_);
gfx::Rect rect = scaled_visible_content_rect;
diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc
index 3bce76f..af8c41a 100644
--- a/cc/layers/render_surface_impl.cc
+++ b/cc/layers/render_surface_impl.cc
@@ -157,7 +157,8 @@ void RenderSurfaceImpl::AppendQuads(QuadSink* quad_sink,
clip_rect_,
is_clipped_,
draw_opacity_,
- owning_layer_->blend_mode());
+ owning_layer_->blend_mode(),
+ owning_layer_->sorting_context_id());
if (owning_layer_->ShowDebugBorders()) {
SkColor color = for_replica ?
diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
index 57f2a54..2377043 100644
--- a/cc/output/renderer_pixeltest.cc
+++ b/cc/output/renderer_pixeltest.cc
@@ -58,6 +58,7 @@ SharedQuadState* CreateTestSharedQuadState(
const bool is_clipped = false;
const float opacity = 1.0f;
const SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode;
+ int sorting_context_id = 0;
SharedQuadState* shared_state = render_pass->CreateAndAppendSharedQuadState();
shared_state->SetAll(content_to_target_transform,
content_bounds,
@@ -65,7 +66,8 @@ SharedQuadState* CreateTestSharedQuadState(
clip_rect,
is_clipped,
opacity,
- blend_mode);
+ blend_mode,
+ sorting_context_id);
return shared_state;
}
@@ -79,6 +81,7 @@ SharedQuadState* CreateTestSharedQuadStateClipped(
const bool is_clipped = true;
const float opacity = 1.0f;
const SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode;
+ int sorting_context_id = 0;
SharedQuadState* shared_state = render_pass->CreateAndAppendSharedQuadState();
shared_state->SetAll(content_to_target_transform,
content_bounds,
@@ -86,7 +89,8 @@ SharedQuadState* CreateTestSharedQuadStateClipped(
clip_rect,
is_clipped,
opacity,
- blend_mode);
+ blend_mode,
+ sorting_context_id);
return shared_state;
}
diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc
index ee5af29..52ff828 100644
--- a/cc/output/software_renderer_unittest.cc
+++ b/cc/output/software_renderer_unittest.cc
@@ -112,7 +112,8 @@ TEST_F(SoftwareRendererTest, SolidColorQuad) {
outer_rect,
false,
1.0,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<SolidColorDrawQuad> outer_quad = SolidColorDrawQuad::Create();
outer_quad->SetNew(
shared_quad_state, outer_rect, outer_rect, SK_ColorYELLOW, false);
@@ -198,7 +199,8 @@ TEST_F(SoftwareRendererTest, TileQuad) {
outer_rect,
false,
1.0,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<TileDrawQuad> outer_quad = TileDrawQuad::Create();
outer_quad->SetNew(shared_quad_state,
outer_rect,
@@ -281,7 +283,8 @@ TEST_F(SoftwareRendererTest, TileQuadVisibleRect) {
tile_rect,
false,
1.0,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create();
quad->SetNew(shared_quad_state,
tile_rect,
diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc
index 7124db2..f0f7719 100644
--- a/cc/quads/draw_quad_unittest.cc
+++ b/cc/quads/draw_quad_unittest.cc
@@ -38,6 +38,7 @@ TEST(DrawQuadTest, CopySharedQuadState) {
bool is_clipped = true;
float opacity = 0.25f;
SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode;
+ int sorting_context_id = 65536;
scoped_ptr<SharedQuadState> state(new SharedQuadState);
state->SetAll(quad_transform,
@@ -46,7 +47,8 @@ TEST(DrawQuadTest, CopySharedQuadState) {
clip_rect,
is_clipped,
opacity,
- blend_mode);
+ blend_mode,
+ sorting_context_id);
scoped_ptr<SharedQuadState> copy(new SharedQuadState);
copy->CopyFrom(state.get());
@@ -65,6 +67,7 @@ scoped_ptr<SharedQuadState> CreateSharedQuadState() {
gfx::Rect clip_rect(19, 21, 23, 25);
bool is_clipped = false;
float opacity = 1.f;
+ int sorting_context_id = 65536;
SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode;
scoped_ptr<SharedQuadState> state(new SharedQuadState);
@@ -74,7 +77,8 @@ scoped_ptr<SharedQuadState> CreateSharedQuadState() {
clip_rect,
is_clipped,
opacity,
- blend_mode);
+ blend_mode,
+ sorting_context_id);
return state.Pass();
}
diff --git a/cc/quads/render_pass_unittest.cc b/cc/quads/render_pass_unittest.cc
index 7f723a4..59af62d 100644
--- a/cc/quads/render_pass_unittest.cc
+++ b/cc/quads/render_pass_unittest.cc
@@ -86,7 +86,8 @@ TEST(RenderPassTest, CopyShouldBeIdenticalExceptIdAndQuads) {
gfx::Rect(),
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<CheckerboardDrawQuad> checkerboard_quad =
CheckerboardDrawQuad::Create();
@@ -136,7 +137,8 @@ TEST(RenderPassTest, CopyAllShouldBeIdentical) {
gfx::Rect(),
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<CheckerboardDrawQuad> checkerboard_quad1 =
CheckerboardDrawQuad::Create();
@@ -162,7 +164,8 @@ TEST(RenderPassTest, CopyAllShouldBeIdentical) {
gfx::Rect(),
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<CheckerboardDrawQuad> checkerboard_quad3 =
CheckerboardDrawQuad::Create();
@@ -203,7 +206,8 @@ TEST(RenderPassTest, CopyAllShouldBeIdentical) {
gfx::Rect(),
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<CheckerboardDrawQuad> contrib_quad =
CheckerboardDrawQuad::Create();
@@ -262,7 +266,8 @@ TEST(RenderPassTest, CopyAllWithCulledQuads) {
gfx::Rect(),
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<CheckerboardDrawQuad> checkerboard_quad1 =
CheckerboardDrawQuad::Create();
@@ -280,7 +285,8 @@ TEST(RenderPassTest, CopyAllWithCulledQuads) {
gfx::Rect(),
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
// A second shared state with no quads.
SharedQuadState* shared_state3 = pass->CreateAndAppendSharedQuadState();
@@ -290,7 +296,8 @@ TEST(RenderPassTest, CopyAllWithCulledQuads) {
gfx::Rect(),
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
// A last shared state with a quad again.
SharedQuadState* shared_state4 = pass->CreateAndAppendSharedQuadState();
@@ -300,7 +307,8 @@ TEST(RenderPassTest, CopyAllWithCulledQuads) {
gfx::Rect(),
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<CheckerboardDrawQuad> checkerboard_quad2 =
CheckerboardDrawQuad::Create();
diff --git a/cc/quads/shared_quad_state.cc b/cc/quads/shared_quad_state.cc
index 444d330..57959e3 100644
--- a/cc/quads/shared_quad_state.cc
+++ b/cc/quads/shared_quad_state.cc
@@ -11,7 +11,11 @@
namespace cc {
SharedQuadState::SharedQuadState()
- : is_clipped(false), opacity(0.f), blend_mode(SkXfermode::kSrcOver_Mode) {}
+ : is_clipped(false),
+ opacity(0.f),
+ blend_mode(SkXfermode::kSrcOver_Mode),
+ sorting_context_id(0) {
+}
SharedQuadState::~SharedQuadState() {
TRACE_EVENT_OBJECT_DELETED_WITH_ID(
@@ -29,7 +33,8 @@ void SharedQuadState::SetAll(const gfx::Transform& content_to_target_transform,
const gfx::Rect& clip_rect,
bool is_clipped,
float opacity,
- SkXfermode::Mode blend_mode) {
+ SkXfermode::Mode blend_mode,
+ int sorting_context_id) {
this->content_to_target_transform = content_to_target_transform;
this->content_bounds = content_bounds;
this->visible_content_rect = visible_content_rect;
@@ -37,6 +42,7 @@ void SharedQuadState::SetAll(const gfx::Transform& content_to_target_transform,
this->is_clipped = is_clipped;
this->opacity = opacity;
this->blend_mode = blend_mode;
+ this->sorting_context_id = sorting_context_id;
}
scoped_ptr<base::Value> SharedQuadState::AsValue() const {
diff --git a/cc/quads/shared_quad_state.h b/cc/quads/shared_quad_state.h
index d0e2afb..30a1e25 100644
--- a/cc/quads/shared_quad_state.h
+++ b/cc/quads/shared_quad_state.h
@@ -35,7 +35,8 @@ class CC_EXPORT SharedQuadState {
const gfx::Rect& clip_rect,
bool is_clipped,
float opacity,
- SkXfermode::Mode blend_mode);
+ SkXfermode::Mode blend_mode,
+ int sorting_context_id);
scoped_ptr<base::Value> AsValue() const;
// Transforms from quad's original content space to its target content space.
@@ -49,6 +50,7 @@ class CC_EXPORT SharedQuadState {
bool is_clipped;
float opacity;
SkXfermode::Mode blend_mode;
+ int sorting_context_id;
};
} // namespace cc
diff --git a/cc/surfaces/surface_aggregator_test_helpers.cc b/cc/surfaces/surface_aggregator_test_helpers.cc
index 747f84a..a653eb1 100644
--- a/cc/surfaces/surface_aggregator_test_helpers.cc
+++ b/cc/surfaces/surface_aggregator_test_helpers.cc
@@ -40,7 +40,8 @@ void AddTestSurfaceQuad(TestRenderPass* pass,
clip_rect,
is_clipped,
opacity,
- blend_mode);
+ blend_mode,
+ 0);
scoped_ptr<SurfaceDrawQuad> surface_quad = SurfaceDrawQuad::Create();
gfx::Rect quad_rect = gfx::Rect(surface_size);
@@ -60,7 +61,8 @@ void AddTestRenderPassQuad(TestRenderPass* pass,
output_rect,
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create();
quad->SetNew(shared_state,
output_rect,
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc
index aa5cea0..62ba079 100644
--- a/cc/surfaces/surface_aggregator_unittest.cc
+++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -430,7 +430,8 @@ void AddSolidColorQuadWithBlendMode(const gfx::Size& size,
clip_rect,
is_clipped,
opacity,
- blend_mode);
+ blend_mode,
+ 0);
scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create();
color_quad->SetNew(pass->shared_quad_state_list.back(),
diff --git a/cc/surfaces/surfaces_pixeltest.cc b/cc/surfaces/surfaces_pixeltest.cc
index 3559d53..9afb4c6 100644
--- a/cc/surfaces/surfaces_pixeltest.cc
+++ b/cc/surfaces/surfaces_pixeltest.cc
@@ -40,7 +40,8 @@ SharedQuadState* CreateAndAppendTestSharedQuadState(
clip_rect,
is_clipped,
opacity,
- blend_mode);
+ blend_mode,
+ 0);
return shared_state;
}
diff --git a/cc/test/layer_tree_host_common_test.h b/cc/test/layer_tree_host_common_test.h
index 38dd85a..67eb6cc 100644
--- a/cc/test/layer_tree_host_common_test.h
+++ b/cc/test/layer_tree_host_common_test.h
@@ -43,7 +43,7 @@ class LayerTreeHostCommonTestBase {
layer->SetPosition(position);
layer->SetBounds(bounds);
layer->SetShouldFlattenTransform(flatten_transform);
- layer->SetIs3dSorted(is_3d_sorted);
+ layer->Set3dSortingContextId(is_3d_sorted ? 1 : 0);
}
void SetLayerPropertiesForTesting(Layer* layer,
diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc
index e94bbea..f177e118 100644
--- a/cc/test/layer_tree_json_parser.cc
+++ b/cc/test/layer_tree_json_parser.cc
@@ -130,8 +130,10 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val,
new_layer->SetHaveScrollEventHandlers(scroll_handler);
bool is_3d_sorted;
- if (dict->GetBoolean("Is3DSorted", &is_3d_sorted))
- new_layer->SetIs3dSorted(is_3d_sorted);
+ if (dict->GetBoolean("Is3DSorted", &is_3d_sorted)) {
+ // A non-zero context ID will put the layer into a 3D sorting context
+ new_layer->Set3dSortingContextId(1);
+ }
if (dict->HasKey("TouchRegion")) {
success &= dict->GetList("TouchRegion", &list);
diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc
index dd58b43..9cbb987 100644
--- a/cc/test/render_pass_test_common.cc
+++ b/cc/test/render_pass_test_common.cc
@@ -80,7 +80,8 @@ void TestRenderPass::AppendOneOfEveryQuadType(
rect,
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<CheckerboardDrawQuad> checkerboard_quad =
CheckerboardDrawQuad::Create();
@@ -197,7 +198,8 @@ void TestRenderPass::AppendOneOfEveryQuadType(
rect,
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<TileDrawQuad> tile_quad = TileDrawQuad::Create();
tile_quad->SetNew(shared_state2,
diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc
index 43cbf1f..7ea3a7a 100644
--- a/cc/test/render_pass_test_utils.cc
+++ b/cc/test/render_pass_test_utils.cc
@@ -37,7 +37,8 @@ SolidColorDrawQuad* AddQuad(TestRenderPass* pass,
rect,
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
quad->SetNew(shared_state, rect, rect, color, false);
SolidColorDrawQuad* quad_ptr = quad.get();
@@ -55,7 +56,8 @@ SolidColorDrawQuad* AddClippedQuad(TestRenderPass* pass,
rect,
true,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
quad->SetNew(shared_state, rect, rect, color, false);
SolidColorDrawQuad* quad_ptr = quad.get();
@@ -68,8 +70,14 @@ SolidColorDrawQuad* AddTransformedQuad(TestRenderPass* pass,
SkColor color,
const gfx::Transform& transform) {
SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState();
- shared_state->SetAll(
- transform, rect.size(), rect, rect, false, 1, SkXfermode::kSrcOver_Mode);
+ shared_state->SetAll(transform,
+ rect.size(),
+ rect,
+ rect,
+ false,
+ 1,
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
quad->SetNew(shared_state, rect, rect, color, false);
SolidColorDrawQuad* quad_ptr = quad.get();
@@ -87,7 +95,8 @@ void AddRenderPassQuad(TestRenderPass* to_pass,
output_rect,
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create();
quad->SetNew(shared_state,
output_rect,
@@ -115,7 +124,8 @@ void AddRenderPassQuad(TestRenderPass* to_pass,
output_rect,
false,
1,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create();
quad->SetNew(shared_state,
output_rect,
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index ebb51a8..3bbbf63 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -327,16 +327,16 @@ template <typename LayerType> static inline bool IsRootLayer(LayerType* layer) {
template <typename LayerType>
static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) {
- return layer->is_3d_sorted() && layer->parent() &&
- layer->parent()->is_3d_sorted();
+ return layer->Is3dSorted() && layer->parent() &&
+ layer->parent()->Is3dSorted();
}
template <typename LayerType>
static bool IsRootLayerOfNewRenderingContext(LayerType* layer) {
if (layer->parent())
- return !layer->parent()->is_3d_sorted() && layer->is_3d_sorted();
+ return !layer->parent()->Is3dSorted() && layer->Is3dSorted();
- return layer->is_3d_sorted();
+ return layer->Is3dSorted();
}
template <typename LayerType>
@@ -2365,7 +2365,7 @@ static void CalculateDrawPropertiesInternal(
// drawn from back to front. If the preserves-3d property is also set on the
// parent then skip the sorting as the parent will sort all the descendants
// anyway.
- if (globals.layer_sorter && descendants.size() && layer->is_3d_sorted() &&
+ if (globals.layer_sorter && descendants.size() && layer->Is3dSorted() &&
!LayerIsInExisting3DRenderingContext(layer)) {
SortLayers(descendants.begin() + sorting_start_index,
descendants.end(),
diff --git a/cc/trees/layer_tree_host_common_perftest.cc b/cc/trees/layer_tree_host_common_perftest.cc
index eb80c63..02b0770 100644
--- a/cc/trees/layer_tree_host_common_perftest.cc
+++ b/cc/trees/layer_tree_host_common_perftest.cc
@@ -193,7 +193,7 @@ class LayerSorterMainTest : public CalcDrawPropsImplTest {
}
void BuildLayerImplList(LayerImpl* layer, LayerImplList* list) {
- if (layer->is_3d_sorted()) {
+ if (layer->Is3dSorted()) {
list->push_back(layer);
}
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 2186c20..8dcb6d7 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -4000,8 +4000,8 @@ TEST_F(LayerTreeHostCommonTest,
true,
false);
- front_facing_surface->SetIs3dSorted(true);
- back_facing_surface->SetIs3dSorted(true);
+ front_facing_surface->Set3dSortingContextId(1);
+ back_facing_surface->Set3dSortingContextId(1);
RenderSurfaceLayerList render_surface_layer_list;
LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
@@ -6976,8 +6976,8 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
false);
child3->SetDrawsContent(true);
- child2->SetIs3dSorted(true);
- child3->SetIs3dSorted(true);
+ child2->Set3dSortingContextId(1);
+ child3->Set3dSortingContextId(1);
child2->AddChild(child3.Pass());
child1->AddChild(child2.Pass());
@@ -7037,7 +7037,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) {
false);
root->SetShouldFlattenTransform(false);
- root->SetIs3dSorted(true);
+ root->Set3dSortingContextId(1);
render_surface->SetDoubleSided(false);
render_surface->SetForceRenderSurface(true);
@@ -7665,7 +7665,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
true);
scroll_child->SetShouldFlattenTransform(false);
- scroll_child->SetIs3dSorted(true);
+ scroll_child->Set3dSortingContextId(1);
scroll_child->AddChild(top_content.Pass());
scroll_child->AddChild(bottom_content.Pass());
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 53c2f0d..9b22e48 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -651,6 +651,7 @@ static void AppendQuadsToFillScreen(
gfx::Rect root_target_rect = root_layer->render_surface()->content_rect();
float opacity = 1.f;
+ int sorting_context_id = 0;
SharedQuadState* shared_quad_state = quad_culler.CreateSharedQuadState();
shared_quad_state->SetAll(gfx::Transform(),
root_target_rect.size(),
@@ -658,7 +659,8 @@ static void AppendQuadsToFillScreen(
root_target_rect,
false,
opacity,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ sorting_context_id);
for (Region::Iterator fill_rects(screen_background_color_region);
fill_rects.has_rect();
diff --git a/cc/trees/layer_tree_host_pixeltest_filters.cc b/cc/trees/layer_tree_host_pixeltest_filters.cc
index 2337611..c8c8c7a 100644
--- a/cc/trees/layer_tree_host_pixeltest_filters.cc
+++ b/cc/trees/layer_tree_host_pixeltest_filters.cc
@@ -111,17 +111,17 @@ TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlurOffAxis) {
background->AddChild(blur);
background->SetShouldFlattenTransform(false);
- background->SetIs3dSorted(true);
+ background->Set3dSortingContextId(1);
green->SetShouldFlattenTransform(false);
- green->SetIs3dSorted(true);
+ green->Set3dSortingContextId(1);
gfx::Transform background_transform;
background_transform.ApplyPerspectiveDepth(200.0);
background->SetTransform(background_transform);
blur->SetShouldFlattenTransform(false);
- blur->SetIs3dSorted(true);
+ blur->Set3dSortingContextId(1);
for (size_t i = 0; i < blur->children().size(); ++i)
- blur->children()[i]->SetIs3dSorted(true);
+ blur->children()[i]->Set3dSortingContextId(1);
gfx::Transform blur_transform;
blur_transform.Translate(55.0, 65.0);
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 91bad3e..006fc35 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -983,7 +983,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
false);
root->SetDrawsContent(true);
root->SetShouldFlattenTransform(false);
- root->SetIs3dSorted(true);
+ root->Set3dSortingContextId(1);
{
// child 1 and child2 are initialized to overlap between x=50 and x=60.
// grand_child is set to overlap both child1 and child2 between y=50 and
@@ -1009,7 +1009,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
false);
child1->SetDrawsContent(true);
child1->SetShouldFlattenTransform(false);
- child1->SetIs3dSorted(true);
+ child1->Set3dSortingContextId(1);
position = gfx::PointF(50.f, 10.f);
bounds = gfx::Size(50, 50);
@@ -1024,7 +1024,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
false);
child2->SetDrawsContent(true);
child2->SetShouldFlattenTransform(false);
- child2->SetIs3dSorted(true);
+ child2->Set3dSortingContextId(1);
// Remember that grand_child is positioned with respect to its parent (i.e.
// child1). In screen space, the intended position is (10, 50), with size
diff --git a/cc/trees/occlusion_tracker.cc b/cc/trees/occlusion_tracker.cc
index b549f89..f4a414f 100644
--- a/cc/trees/occlusion_tracker.cc
+++ b/cc/trees/occlusion_tracker.cc
@@ -131,7 +131,7 @@ static inline bool SurfaceTransformsToScreenKnown(const RenderSurfaceImpl* rs) {
}
static inline bool LayerIsInUnsorted3dRenderingContext(const Layer* layer) {
- return layer->is_3d_sorted();
+ return layer->Is3dSorted();
}
static inline bool LayerIsInUnsorted3dRenderingContext(const LayerImpl* layer) {
return false;
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc
index 89165b8..1a6529b 100644
--- a/cc/trees/occlusion_tracker_unittest.cc
+++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -1903,9 +1903,9 @@ class OcclusionTrackerTestUnsorted3dLayers
gfx::Size(100, 100),
true);
parent->SetShouldFlattenTransform(false);
- parent->SetIs3dSorted(true);
- child1->SetIs3dSorted(true);
- child2->SetIs3dSorted(true);
+ parent->Set3dSortingContextId(1);
+ child1->Set3dSortingContextId(1);
+ child2->Set3dSortingContextId(1);
this->CalcDrawEtc(parent);
@@ -1949,8 +1949,8 @@ class OcclusionTrackerTestPerspectiveTransform
gfx::Size(200, 200),
true);
container->SetShouldFlattenTransform(false);
- container->SetIs3dSorted(true);
- layer->SetIs3dSorted(true);
+ container->Set3dSortingContextId(1);
+ layer->Set3dSortingContextId(1);
layer->SetShouldFlattenTransform(false);
this->CalcDrawEtc(parent);
@@ -1994,9 +1994,9 @@ class OcclusionTrackerTestPerspectiveTransformBehindCamera
typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
container, transform, gfx::PointF(), gfx::Size(500, 500), true);
container->SetShouldFlattenTransform(false);
- container->SetIs3dSorted(true);
+ container->Set3dSortingContextId(1);
layer->SetShouldFlattenTransform(false);
- layer->SetIs3dSorted(true);
+ layer->Set3dSortingContextId(1);
this->CalcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
@@ -2037,9 +2037,9 @@ class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude
typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
parent, transform, gfx::PointF(), gfx::Size(100, 100), true);
parent->SetShouldFlattenTransform(false);
- parent->SetIs3dSorted(true);
+ parent->Set3dSortingContextId(1);
layer->SetShouldFlattenTransform(false);
- layer->SetIs3dSorted(true);
+ layer->Set3dSortingContextId(1);
this->CalcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
@@ -2078,9 +2078,9 @@ class OcclusionTrackerTestLargePixelsOccludeInsideClipRect
typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
parent, transform, gfx::PointF(), gfx::Size(100, 100), true);
parent->SetShouldFlattenTransform(false);
- parent->SetIs3dSorted(true);
+ parent->Set3dSortingContextId(1);
layer->SetShouldFlattenTransform(false);
- layer->SetIs3dSorted(true);
+ layer->Set3dSortingContextId(1);
this->CalcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
diff --git a/content/common/cc_messages.h b/content/common/cc_messages.h
index a2eaa63..da416eb 100644
--- a/content/common/cc_messages.h
+++ b/content/common/cc_messages.h
@@ -238,6 +238,7 @@ IPC_STRUCT_TRAITS_BEGIN(cc::SharedQuadState)
IPC_STRUCT_TRAITS_MEMBER(is_clipped)
IPC_STRUCT_TRAITS_MEMBER(opacity)
IPC_STRUCT_TRAITS_MEMBER(blend_mode)
+ IPC_STRUCT_TRAITS_MEMBER(sorting_context_id)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(cc::TransferableResource)
diff --git a/content/common/cc_messages_unittest.cc b/content/common/cc_messages_unittest.cc
index 3d4499d..d0ceb69 100644
--- a/content/common/cc_messages_unittest.cc
+++ b/content/common/cc_messages_unittest.cc
@@ -63,6 +63,7 @@ class CCMessagesTest : public testing::Test {
EXPECT_EQ(a->is_clipped, b->is_clipped);
EXPECT_EQ(a->opacity, b->opacity);
EXPECT_EQ(a->blend_mode, b->blend_mode);
+ EXPECT_EQ(a->sorting_context_id, b->sorting_context_id);
}
void Compare(const DrawQuad* a, const DrawQuad* b) {
@@ -247,6 +248,9 @@ TEST_F(CCMessagesTest, AllQuads) {
bool arbitrary_bool1 = true;
bool arbitrary_bool2 = false;
bool arbitrary_bool3 = true;
+ int arbitrary_context_id1 = 12;
+ int arbitrary_context_id2 = 57;
+ int arbitrary_context_id3 = -503;
int arbitrary_int = 5;
SkColor arbitrary_color = SkColorSetARGB(25, 36, 47, 58);
SkXfermode::Mode arbitrary_blend_mode1 = SkXfermode::kScreen_Mode;
@@ -289,7 +293,8 @@ TEST_F(CCMessagesTest, AllQuads) {
arbitrary_rect2,
arbitrary_bool1,
arbitrary_float1,
- arbitrary_blend_mode1);
+ arbitrary_blend_mode1,
+ arbitrary_context_id1);
scoped_ptr<RenderPass> pass_cmp = RenderPass::Create();
pass_cmp->SetAll(arbitrary_id,
@@ -345,7 +350,8 @@ TEST_F(CCMessagesTest, AllQuads) {
arbitrary_rect3,
arbitrary_bool1,
arbitrary_float2,
- arbitrary_blend_mode2);
+ arbitrary_blend_mode2,
+ arbitrary_context_id2);
SharedQuadState* shared_state2_cmp =
pass_cmp->CreateAndAppendSharedQuadState();
shared_state2_cmp->CopyFrom(shared_state2_in);
@@ -374,7 +380,8 @@ TEST_F(CCMessagesTest, AllQuads) {
arbitrary_rect1,
arbitrary_bool1,
arbitrary_float3,
- arbitrary_blend_mode3);
+ arbitrary_blend_mode3,
+ arbitrary_context_id3);
SharedQuadState* shared_state3_cmp =
pass_cmp->CreateAndAppendSharedQuadState();
shared_state3_cmp->CopyFrom(shared_state3_in);
@@ -553,7 +560,8 @@ TEST_F(CCMessagesTest, UnusedSharedQuadStates) {
gfx::Rect(),
false,
1.f,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
quad = CheckerboardDrawQuad::Create();
quad->SetAll(shared_state1_in,
@@ -572,7 +580,8 @@ TEST_F(CCMessagesTest, UnusedSharedQuadStates) {
gfx::Rect(),
false,
1.f,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
SharedQuadState* shared_state3_in = pass_in->CreateAndAppendSharedQuadState();
shared_state3_in->SetAll(gfx::Transform(),
@@ -581,7 +590,8 @@ TEST_F(CCMessagesTest, UnusedSharedQuadStates) {
gfx::Rect(),
false,
1.f,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
// The fourth SharedQuadState is used.
SharedQuadState* shared_state4_in = pass_in->CreateAndAppendSharedQuadState();
@@ -591,7 +601,8 @@ TEST_F(CCMessagesTest, UnusedSharedQuadStates) {
gfx::Rect(),
false,
1.f,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
quad = CheckerboardDrawQuad::Create();
quad->SetAll(shared_state4_in,
@@ -610,7 +621,8 @@ TEST_F(CCMessagesTest, UnusedSharedQuadStates) {
gfx::Rect(),
false,
1.f,
- SkXfermode::kSrcOver_Mode);
+ SkXfermode::kSrcOver_Mode,
+ 0);
// 5 SharedQuadStates go in.
ASSERT_EQ(5u, pass_in->shared_quad_state_list.size());
diff --git a/content/renderer/compositor_bindings/web_layer_impl.cc b/content/renderer/compositor_bindings/web_layer_impl.cc
index a575412..1dde06b 100644
--- a/content/renderer/compositor_bindings/web_layer_impl.cc
+++ b/content/renderer/compositor_bindings/web_layer_impl.cc
@@ -212,7 +212,7 @@ void WebLayerImpl::setShouldFlattenTransform(bool flatten) {
}
void WebLayerImpl::setRenderingContext(int context) {
- layer_->SetIs3dSorted(context != 0);
+ layer_->Set3dSortingContextId(context);
}
void WebLayerImpl::setUseParentBackfaceVisibility(