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

Side by Side Diff: content/renderer/compositor_bindings/web_layer_impl_fixed_bounds.cc

Issue 317163002: Moving compositor_bindings from webkit to content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing dependencies due to failing ios bots Created 6 years, 6 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h" 5 #include "content/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 8 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
9 #include "third_party/WebKit/public/platform/WebSize.h" 9 #include "third_party/WebKit/public/platform/WebSize.h"
10 #include "third_party/skia/include/utils/SkMatrix44.h" 10 #include "third_party/skia/include/utils/SkMatrix44.h"
11 11
12 using cc::Layer; 12 using cc::Layer;
13 13
14 namespace webkit { 14 namespace content {
15 15
16 WebLayerImplFixedBounds::WebLayerImplFixedBounds() { 16 WebLayerImplFixedBounds::WebLayerImplFixedBounds() {
17 } 17 }
18 18
19 WebLayerImplFixedBounds::WebLayerImplFixedBounds(scoped_refptr<Layer> layer) 19 WebLayerImplFixedBounds::WebLayerImplFixedBounds(scoped_refptr<Layer> layer)
20 : WebLayerImpl(layer) { 20 : WebLayerImpl(layer) {
21 } 21 }
22 22
23
24 WebLayerImplFixedBounds::~WebLayerImplFixedBounds() { 23 WebLayerImplFixedBounds::~WebLayerImplFixedBounds() {
25 } 24 }
26 25
27 void WebLayerImplFixedBounds::invalidateRect(const blink::WebFloatRect& rect) { 26 void WebLayerImplFixedBounds::invalidateRect(const blink::WebFloatRect& rect) {
28 // Partial invalidations seldom occur for such layers. 27 // Partial invalidations seldom occur for such layers.
29 // Simply invalidate the whole layer to avoid transformation of coordinates. 28 // Simply invalidate the whole layer to avoid transformation of coordinates.
30 invalidate(); 29 invalidate();
31 } 30 }
32 31
33 void WebLayerImplFixedBounds::setTransformOrigin( 32 void WebLayerImplFixedBounds::setTransformOrigin(
34 const blink::WebFloatPoint3D& transform_origin) { 33 const blink::WebFloatPoint3D& transform_origin) {
35 if (transform_origin != this->transformOrigin()) { 34 if (transform_origin != this->transformOrigin()) {
36 layer_->SetTransformOrigin(transform_origin); 35 layer_->SetTransformOrigin(transform_origin);
37 UpdateLayerBoundsAndTransform(); 36 UpdateLayerBoundsAndTransform();
38 } 37 }
39 } 38 }
40 39
41 void WebLayerImplFixedBounds::setBounds(const blink::WebSize& bounds) { 40 void WebLayerImplFixedBounds::setBounds(const blink::WebSize& bounds) {
42 if (original_bounds_ != gfx::Size(bounds)) { 41 if (original_bounds_ != gfx::Size(bounds)) {
43 original_bounds_ = bounds; 42 original_bounds_ = bounds;
44 UpdateLayerBoundsAndTransform(); 43 UpdateLayerBoundsAndTransform();
45 } 44 }
46 } 45 }
47 46
48 blink::WebSize WebLayerImplFixedBounds::bounds() const { 47 blink::WebSize WebLayerImplFixedBounds::bounds() const {
49 return original_bounds_; 48 return original_bounds_;
50 } 49 }
51 50
52 void WebLayerImplFixedBounds::setTransform(const SkMatrix44& matrix) { 51 void WebLayerImplFixedBounds::setTransform(const SkMatrix44& matrix) {
53 gfx::Transform transform; 52 gfx::Transform transform;
54 transform.matrix() = matrix; 53 transform.matrix() = matrix;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Apply bounds scale (bounds/fixed_bounds) over original transform. 90 // Apply bounds scale (bounds/fixed_bounds) over original transform.
92 gfx::Transform transform_with_bounds_scale(original_transform_); 91 gfx::Transform transform_with_bounds_scale(original_transform_);
93 float bounds_scale_x = 92 float bounds_scale_x =
94 static_cast<float>(original_bounds_.width()) / fixed_bounds_.width(); 93 static_cast<float>(original_bounds_.width()) / fixed_bounds_.width();
95 float bounds_scale_y = 94 float bounds_scale_y =
96 static_cast<float>(original_bounds_.height()) / fixed_bounds_.height(); 95 static_cast<float>(original_bounds_.height()) / fixed_bounds_.height();
97 transform_with_bounds_scale.Scale(bounds_scale_x, bounds_scale_y); 96 transform_with_bounds_scale.Scale(bounds_scale_x, bounds_scale_y);
98 layer_->SetTransform(transform_with_bounds_scale); 97 layer_->SetTransform(transform_with_bounds_scale);
99 } 98 }
100 99
101 } // namespace webkit 100 } // namespace content
101
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698