summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-16 22:10:39 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-16 22:10:39 +0000
commitbaf64d069a6bbc6e87f3ce9eaf7ed5bb775f0965 (patch)
tree3de20466f2bcaa503f948d9b3e0641b5cd87c2cf /webkit
parent3d9439933e04fcfa66b6e8ef05e809b6b6e40bd5 (diff)
downloadchromium_src-baf64d069a6bbc6e87f3ce9eaf7ed5bb775f0965.zip
chromium_src-baf64d069a6bbc6e87f3ce9eaf7ed5bb775f0965.tar.gz
chromium_src-baf64d069a6bbc6e87f3ce9eaf7ed5bb775f0965.tar.bz2
No more sublayer transform in cc.
We don't use it in blink. Let's get rid of it in cc, too. Note: depends on https://codereview.chromium.org/78233009/. R=enne@chromium.org BUG=None Review URL: https://codereview.chromium.org/167753002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/renderer/compositor_bindings/web_layer_impl.cc10
-rw-r--r--webkit/renderer/compositor_bindings/web_layer_impl.h2
-rw-r--r--webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.cc28
-rw-r--r--webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h4
-rw-r--r--webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds_unittest.cc44
5 files changed, 5 insertions, 83 deletions
diff --git a/webkit/renderer/compositor_bindings/web_layer_impl.cc b/webkit/renderer/compositor_bindings/web_layer_impl.cc
index 22a3113..0cac5f9 100644
--- a/webkit/renderer/compositor_bindings/web_layer_impl.cc
+++ b/webkit/renderer/compositor_bindings/web_layer_impl.cc
@@ -162,16 +162,6 @@ void WebLayerImpl::setPosition(const WebFloatPoint& position) {
WebFloatPoint WebLayerImpl::position() const { return layer_->position(); }
-void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) {
- gfx::Transform sub_layer_transform;
- sub_layer_transform.matrix() = matrix;
- layer_->SetSublayerTransform(sub_layer_transform);
-}
-
-SkMatrix44 WebLayerImpl::sublayerTransform() const {
- return layer_->sublayer_transform().matrix();
-}
-
void WebLayerImpl::setTransform(const SkMatrix44& matrix) {
gfx::Transform transform;
transform.matrix() = matrix;
diff --git a/webkit/renderer/compositor_bindings/web_layer_impl.h b/webkit/renderer/compositor_bindings/web_layer_impl.h
index fc5613b..93c6125 100644
--- a/webkit/renderer/compositor_bindings/web_layer_impl.h
+++ b/webkit/renderer/compositor_bindings/web_layer_impl.h
@@ -85,8 +85,6 @@ class WebLayerImpl : public blink::WebLayer, public cc::LayerClient {
virtual bool opaque() const;
virtual void setPosition(const blink::WebFloatPoint& position);
virtual blink::WebFloatPoint position() const;
- virtual void setSublayerTransform(const SkMatrix44&);
- virtual SkMatrix44 sublayerTransform() const;
virtual void setTransform(const SkMatrix44& transform);
virtual SkMatrix44 transform() const;
virtual void setDrawsContent(bool draws_content);
diff --git a/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.cc b/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.cc
index a62fcee..ec6d743 100644
--- a/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.cc
+++ b/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.cc
@@ -49,16 +49,6 @@ blink::WebSize WebLayerImplFixedBounds::bounds() const {
return original_bounds_;
}
-void WebLayerImplFixedBounds::setSublayerTransform(const SkMatrix44& matrix) {
- gfx::Transform transform;
- transform.matrix() = matrix;
- SetSublayerTransformInternal(transform);
-}
-
-SkMatrix44 WebLayerImplFixedBounds::sublayerTransform() const {
- return original_sublayer_transform_.matrix();
-}
-
void WebLayerImplFixedBounds::setTransform(const SkMatrix44& matrix) {
gfx::Transform transform;
transform.matrix() = matrix;
@@ -76,14 +66,6 @@ void WebLayerImplFixedBounds::SetFixedBounds(gfx::Size fixed_bounds) {
}
}
-void WebLayerImplFixedBounds::SetSublayerTransformInternal(
- const gfx::Transform& transform) {
- if (original_sublayer_transform_ != transform) {
- original_sublayer_transform_ = transform;
- UpdateLayerBoundsAndTransform();
- }
-}
-
void WebLayerImplFixedBounds::SetTransformInternal(
const gfx::Transform& transform) {
if (original_transform_ != transform) {
@@ -100,7 +82,6 @@ void WebLayerImplFixedBounds::UpdateLayerBoundsAndTransform() {
anchorPoint().x || anchorPoint().y) {
layer_->SetBounds(original_bounds_);
layer_->SetTransform(original_transform_);
- layer_->SetSublayerTransform(original_sublayer_transform_);
return;
}
@@ -114,15 +95,6 @@ void WebLayerImplFixedBounds::UpdateLayerBoundsAndTransform() {
static_cast<float>(original_bounds_.height()) / fixed_bounds_.height();
transform_with_bounds_scale.Scale(bounds_scale_x, bounds_scale_y);
layer_->SetTransform(transform_with_bounds_scale);
-
- // As we apply extra scale transform on this layer which will propagate to the
- // sublayers, here undo the scale on sublayers.
- gfx::Transform sublayer_transform_with_inverse_bounds_scale;
- sublayer_transform_with_inverse_bounds_scale.Scale(1.f / bounds_scale_x,
- 1.f / bounds_scale_y);
- sublayer_transform_with_inverse_bounds_scale.PreconcatTransform(
- original_sublayer_transform_);
- layer_->SetSublayerTransform(sublayer_transform_with_inverse_bounds_scale);
}
} // namespace webkit
diff --git a/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h b/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h
index bd8a6ff..f338cde 100644
--- a/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h
+++ b/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h
@@ -28,8 +28,6 @@ class WebLayerImplFixedBounds : public WebLayerImpl {
virtual void setAnchorPoint(const blink::WebFloatPoint& anchor_point);
virtual void setBounds(const blink::WebSize& bounds);
virtual blink::WebSize bounds() const;
- virtual void setSublayerTransform(const SkMatrix44& transform);
- virtual SkMatrix44 sublayerTransform() const;
virtual void setTransform(const SkMatrix44& transform);
virtual SkMatrix44 transform() const;
@@ -37,10 +35,8 @@ class WebLayerImplFixedBounds : public WebLayerImpl {
protected:
void SetTransformInternal(const gfx::Transform& transform);
- void SetSublayerTransformInternal(const gfx::Transform& transform);
void UpdateLayerBoundsAndTransform();
- gfx::Transform original_sublayer_transform_;
gfx::Transform original_transform_;
gfx::Size original_bounds_;
gfx::Size fixed_bounds_;
diff --git a/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds_unittest.cc b/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds_unittest.cc
index b171027..ecf8c02 100644
--- a/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds_unittest.cc
+++ b/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds_unittest.cc
@@ -46,7 +46,6 @@ void CheckBoundsScaleSimple(WebLayerImplFixedBounds* layer,
EXPECT_EQ(bounds, layer->bounds());
EXPECT_EQ(fixed_bounds, layer->layer()->bounds());
EXPECT_TRUE(layer->transform().isIdentity());
- EXPECT_TRUE(layer->sublayerTransform().isIdentity());
// An arbitrary point to check the scale and transforms.
gfx::Point3F original_point(10, 20, 1);
@@ -54,14 +53,10 @@ void CheckBoundsScaleSimple(WebLayerImplFixedBounds* layer,
original_point.x() * bounds.width / fixed_bounds.width(),
original_point.y() * bounds.height / fixed_bounds.height(),
original_point.z());
- // Test if the bounds scale is correctly applied in transform and
- // sublayerTransform.
+ // Test if the bounds scale is correctly applied in transform.
EXPECT_POINT3F_EQ(scaled_point,
TransformPoint(layer->layer()->transform(),
original_point));
- EXPECT_POINT3F_EQ(original_point,
- TransformPoint(layer->layer()->sublayer_transform(),
- scaled_point));
}
TEST(WebLayerImplFixedBoundsTest, BoundsScaleSimple) {
@@ -84,46 +79,32 @@ void ExpectEqualLayerRectsInTarget(cc::Layer* layer1, cc::Layer* layer2) {
EXPECT_FLOAT_RECT_EQ(layer1_rect_in_target, layer2_rect_in_target);
}
-void CompareFixedBoundsLayerAndNormalLayer(
- const WebFloatPoint& anchor_point,
- const gfx::Transform& transform,
- const gfx::Transform& sublayer_transform) {
+void CompareFixedBoundsLayerAndNormalLayer(const WebFloatPoint& anchor_point,
+ const gfx::Transform& transform) {
const gfx::Size kDeviceViewportSize(800, 600);
const float kDeviceScaleFactor = 2.f;
const float kPageScaleFactor = 1.5f;
WebSize bounds(150, 200);
WebFloatPoint position(20, 30);
- WebSize sublayer_bounds(88, 99);
- WebFloatPoint sublayer_position(50, 60);
gfx::Size fixed_bounds(160, 70);
scoped_ptr<WebLayerImplFixedBounds> root_layer(new WebLayerImplFixedBounds());
WebLayerImplFixedBounds* fixed_bounds_layer =
new WebLayerImplFixedBounds(cc::PictureImageLayer::Create());
- WebLayerImpl* sublayer_under_fixed_bounds_layer = new WebLayerImpl();
- sublayer_under_fixed_bounds_layer->setBounds(sublayer_bounds);
- sublayer_under_fixed_bounds_layer->setPosition(sublayer_position);
- fixed_bounds_layer->addChild(sublayer_under_fixed_bounds_layer);
fixed_bounds_layer->setBounds(bounds);
fixed_bounds_layer->SetFixedBounds(fixed_bounds);
fixed_bounds_layer->setAnchorPoint(anchor_point);
fixed_bounds_layer->setTransform(transform.matrix());
- fixed_bounds_layer->setSublayerTransform(sublayer_transform.matrix());
fixed_bounds_layer->setPosition(position);
root_layer->addChild(fixed_bounds_layer);
WebLayerImpl* normal_layer(new WebLayerImpl(cc::PictureImageLayer::Create()));
- WebLayerImpl* sublayer_under_normal_layer = new WebLayerImpl();
- sublayer_under_normal_layer->setBounds(sublayer_bounds);
- sublayer_under_normal_layer->setPosition(sublayer_position);
- normal_layer->addChild(sublayer_under_normal_layer);
normal_layer->setBounds(bounds);
normal_layer->setAnchorPoint(anchor_point);
normal_layer->setTransform(transform.matrix());
- normal_layer->setSublayerTransform(sublayer_transform.matrix());
normal_layer->setPosition(position);
root_layer->addChild(normal_layer);
@@ -141,8 +122,6 @@ void CompareFixedBoundsLayerAndNormalLayer(
ExpectEqualLayerRectsInTarget(normal_layer->layer(),
fixed_bounds_layer->layer());
- ExpectEqualLayerRectsInTarget(sublayer_under_normal_layer->layer(),
- sublayer_under_fixed_bounds_layer->layer());
}
// Change of fixed bounds should not affect the target geometries.
@@ -160,8 +139,6 @@ void CompareFixedBoundsLayerAndNormalLayer(
ExpectEqualLayerRectsInTarget(normal_layer->layer(),
fixed_bounds_layer->layer());
- ExpectEqualLayerRectsInTarget(sublayer_under_normal_layer->layer(),
- sublayer_under_fixed_bounds_layer->layer());
}
}
@@ -169,7 +146,6 @@ void CompareFixedBoundsLayerAndNormalLayer(
// geometries. Simple case: identity transforms and zero anchor point.
TEST(WebLayerImplFixedBoundsTest, CompareToWebLayerImplSimple) {
CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0),
- gfx::Transform(),
gfx::Transform());
}
@@ -182,21 +158,11 @@ TEST(WebLayerImplFixedBoundsTest, CompareToWebLayerImplComplex) {
transform.Scale3d(2, 3, 4);
transform.RotateAbout(gfx::Vector3dF(33, 44, 55), 99);
- gfx::Transform sublayer_transform;
- // These are arbitrary values that should not affect the results.
- sublayer_transform.Scale3d(1.1f, 2.2f, 3.3f);
- sublayer_transform.Translate3d(11, 22, 33);
- sublayer_transform.RotateAbout(gfx::Vector3dF(10, 30, 20), 88);
-
- CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0),
- transform,
- sublayer_transform);
+ CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), transform);
// With non-zero anchor point, WebLayerImplFixedBounds will fall back to
// WebLayerImpl.
- CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f),
- transform,
- sublayer_transform);
+ CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), transform);
}
} // namespace