summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorxjz <xjz@chromium.org>2015-11-06 13:48:44 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-06 21:50:13 +0000
commite19f7640d2611e7c7da0c00786a96ee29e3ecd0d (patch)
tree0772bbe36bf71964ad9d22bc9042bc65ec7b0043 /cc
parent78fd1cde9784a3498770465e1c203fb46c25a427 (diff)
downloadchromium_src-e19f7640d2611e7c7da0c00786a96ee29e3ecd0d.zip
chromium_src-e19f7640d2611e7c7da0c00786a96ee29e3ecd0d.tar.gz
chromium_src-e19f7640d2611e7c7da0c00786a96ee29e3ecd0d.tar.bz2
Fixed the bug that window capture clipped the content when the window
is not fully contained in the desktop. This CL is based on the patch set 2 on issue 1398633003: https://codereview.chromium.org/1398633003/#ps40001 BUG=541634, 511841 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1412273006 Cr-Commit-Position: refs/heads/master@{#358414}
Diffstat (limited to 'cc')
-rw-r--r--cc/trees/draw_property_utils.cc7
-rw-r--r--cc/trees/layer_tree_host_common.cc11
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc8
-rw-r--r--cc/trees/layer_tree_host_unittest_copyrequest.cc6
4 files changed, 22 insertions, 10 deletions
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index 1f59140..5ada4f0 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -39,6 +39,13 @@ void CalculateVisibleRects(const std::vector<LayerType*>& visible_layer_list,
const TransformNode* transform_node =
transform_tree.Node(layer->transform_tree_index());
if (!is_unclipped && !fully_visible) {
+ // The entire layer is visible if it has copy requests.
+ if (layer->HasCopyRequest()) {
+ layer->set_visible_rect_from_property_trees(gfx::Rect(layer_bounds));
+ layer->set_clip_rect_in_target_space_from_property_trees(gfx::Rect());
+ continue;
+ }
+
const TransformNode* target_node =
non_root_surfaces_enabled
? transform_tree.Node(transform_node->data.content_target_id)
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 4d14ff7..649f6c2 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -489,6 +489,10 @@ static gfx::Rect CalculateVisibleLayerRect(
layer->drawable_content_rect().IsEmpty())
return gfx::Rect();
+ // The layer is fully visible if it has copy requests.
+ if (layer->HasCopyRequest())
+ return gfx::Rect(layer->bounds());
+
// Compute visible bounds in target surface space.
gfx::Rect visible_rect_in_target_surface_space =
layer->drawable_content_rect();
@@ -2050,8 +2054,8 @@ static void CalculateDrawPropertiesInternal(
gfx::Rect clipped_content_rect = local_drawable_content_rect_of_subtree;
// Don't clip if the layer is reflected as the reflection shouldn't be
- // clipped.
- if (!layer->replica_layer()) {
+ // clipped. Also, don't clip if the layer has copy requests.
+ if (!layer->replica_layer() && !layer->HasCopyRequest()) {
// Note, it is correct to use data_from_ancestor.ancestor_clips_subtree
// here, because we are looking at this layer's render_surface, not the
// layer itself.
@@ -2596,7 +2600,8 @@ void CalculateRenderSurfaceLayerListInternal(
if (layer->DrawsContent())
surface_content_rect.Union(layer->drawable_content_rect());
- if (!layer->replica_layer() && layer->render_surface()->is_clipped()) {
+ if (!layer->replica_layer() && !layer->HasCopyRequest() &&
+ layer->render_surface()->is_clipped()) {
// Here, we clip the render surface's content rect with its clip rect.
// As the clip rect of render surface is in the surface's target
// space, we first map the content rect into the target space,
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 2ea5b2a..e42460d 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -5449,13 +5449,13 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
inputs.can_adjust_raster_scales = true;
LayerTreeHostCommon::CalculateDrawProperties(&inputs);
- // We should have one render surface, as the others are clipped out.
- ASSERT_EQ(1u, render_surface_layer_list.size());
+ // We should have two render surface, as the others are clipped out.
+ ASSERT_EQ(2u, render_surface_layer_list.size());
EXPECT_EQ(root->id(), render_surface_layer_list.at(0)->id());
- // The root render surface should only have 1 contributing layer, since the
+ // The root render surface should only have 2 contributing layer, since the
// other layers are empty/clipped away.
- ASSERT_EQ(1u, root->render_surface()->layer_list().size());
+ ASSERT_EQ(2u, root->render_surface()->layer_list().size());
EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id());
}
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc
index 802a014..0ddc7b7 100644
--- a/cc/trees/layer_tree_host_unittest_copyrequest.cc
+++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc
@@ -473,10 +473,10 @@ class LayerTreeHostCopyRequestTestClippedOut
}
void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
- // We should still get a callback with no output if the copy requested layer
- // was completely clipped away.
+ // We should still get the content even if the copy requested layer was
+ // completely clipped away.
EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
- EXPECT_EQ(gfx::Size().ToString(), result->size().ToString());
+ EXPECT_EQ(gfx::Size(10, 10).ToString(), result->size().ToString());
EndTest();
}