| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/compositor_bindings/web_layer_impl.h" | 5 #include "webkit/compositor_bindings/web_layer_impl.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "cc/animation.h" | 8 #include "cc/animation.h" |
| 9 #include "cc/layer.h" | 9 #include "cc/layer.h" |
| 10 #include "cc/region.h" | 10 #include "cc/region.h" |
| 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
| 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
| 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa
trix.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa
trix.h" |
| 15 #include "third_party/skia/include/utils/SkMatrix44.h" | 15 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 16 #include "webkit/compositor_bindings/web_animation_impl.h" | 16 #include "webkit/compositor_bindings/web_animation_impl.h" |
| 17 #include "webkit/compositor_bindings/web_transformation_matrix_util.h" | 17 #include "webkit/compositor_bindings/web_transformation_matrix_util.h" |
| 18 | 18 |
| 19 using cc::Animation; | 19 using cc::Animation; |
| 20 using cc::Layer; | 20 using cc::Layer; |
| 21 using webkit::WebTransformationMatrixUtil; | 21 using webkit::WebTransformationMatrixUtil; |
| 22 | 22 |
| 23 namespace WebKit { | 23 namespace WebKit { |
| 24 | 24 |
| 25 WebLayerImpl::WebLayerImpl() : layer_(Layer::create()) {} | 25 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) {} |
| 26 | 26 |
| 27 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) {} | 27 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) {} |
| 28 | 28 |
| 29 WebLayerImpl::~WebLayerImpl() { | 29 WebLayerImpl::~WebLayerImpl() { |
| 30 layer_->clearRenderSurface(); | 30 layer_->ClearRenderSurface(); |
| 31 layer_->setLayerAnimationDelegate(0); | 31 layer_->set_layer_animation_delegate(NULL); |
| 32 } | 32 } |
| 33 | 33 |
| 34 int WebLayerImpl::id() const { return layer_->id(); } | 34 int WebLayerImpl::id() const { return layer_->id(); } |
| 35 | 35 |
| 36 void WebLayerImpl::invalidateRect(const WebFloatRect& rect) { | 36 void WebLayerImpl::invalidateRect(const WebFloatRect& rect) { |
| 37 layer_->setNeedsDisplayRect(rect); | 37 layer_->SetNeedsDisplayRect(rect); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void WebLayerImpl::invalidate() { layer_->setNeedsDisplay(); } | 40 void WebLayerImpl::invalidate() { layer_->SetNeedsDisplay(); } |
| 41 | 41 |
| 42 void WebLayerImpl::addChild(WebLayer* child) { | 42 void WebLayerImpl::addChild(WebLayer* child) { |
| 43 layer_->addChild(static_cast<WebLayerImpl*>(child)->layer()); | 43 layer_->AddChild(static_cast<WebLayerImpl*>(child)->layer()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void WebLayerImpl::insertChild(WebLayer* child, size_t index) { | 46 void WebLayerImpl::insertChild(WebLayer* child, size_t index) { |
| 47 layer_->insertChild(static_cast<WebLayerImpl*>(child)->layer(), index); | 47 layer_->InsertChild(static_cast<WebLayerImpl*>(child)->layer(), index); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void WebLayerImpl::replaceChild(WebLayer* reference, WebLayer* new_layer) { | 50 void WebLayerImpl::replaceChild(WebLayer* reference, WebLayer* new_layer) { |
| 51 layer_->replaceChild(static_cast<WebLayerImpl*>(reference)->layer(), | 51 layer_->ReplaceChild(static_cast<WebLayerImpl*>(reference)->layer(), |
| 52 static_cast<WebLayerImpl*>(new_layer)->layer()); | 52 static_cast<WebLayerImpl*>(new_layer)->layer()); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void WebLayerImpl::removeFromParent() { layer_->removeFromParent(); } | 55 void WebLayerImpl::removeFromParent() { layer_->RemoveFromParent(); } |
| 56 | 56 |
| 57 void WebLayerImpl::removeAllChildren() { layer_->removeAllChildren(); } | 57 void WebLayerImpl::removeAllChildren() { layer_->RemoveAllChildren(); } |
| 58 | 58 |
| 59 void WebLayerImpl::setAnchorPoint(const WebFloatPoint& anchor_point) { | 59 void WebLayerImpl::setAnchorPoint(const WebFloatPoint& anchor_point) { |
| 60 layer_->setAnchorPoint(anchor_point); | 60 layer_->SetAnchorPoint(anchor_point); |
| 61 } | 61 } |
| 62 | 62 |
| 63 WebFloatPoint WebLayerImpl::anchorPoint() const { | 63 WebFloatPoint WebLayerImpl::anchorPoint() const { |
| 64 return layer_->anchorPoint(); | 64 return layer_->anchor_point(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void WebLayerImpl::setAnchorPointZ(float anchor_point_z) { | 67 void WebLayerImpl::setAnchorPointZ(float anchor_point_z) { |
| 68 layer_->setAnchorPointZ(anchor_point_z); | 68 layer_->SetAnchorPointZ(anchor_point_z); |
| 69 } | 69 } |
| 70 | 70 |
| 71 float WebLayerImpl::anchorPointZ() const { return layer_->anchorPointZ(); } | 71 float WebLayerImpl::anchorPointZ() const { return layer_->anchor_point_z(); } |
| 72 | 72 |
| 73 void WebLayerImpl::setBounds(const WebSize& size) { layer_->setBounds(size); } | 73 void WebLayerImpl::setBounds(const WebSize& size) { layer_->SetBounds(size); } |
| 74 | 74 |
| 75 WebSize WebLayerImpl::bounds() const { return layer_->bounds(); } | 75 WebSize WebLayerImpl::bounds() const { return layer_->bounds(); } |
| 76 | 76 |
| 77 void WebLayerImpl::setMasksToBounds(bool masks_to_bounds) { | 77 void WebLayerImpl::setMasksToBounds(bool masks_to_bounds) { |
| 78 layer_->setMasksToBounds(masks_to_bounds); | 78 layer_->SetMasksToBounds(masks_to_bounds); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool WebLayerImpl::masksToBounds() const { return layer_->masksToBounds(); } | 81 bool WebLayerImpl::masksToBounds() const { return layer_->masks_to_bounds(); } |
| 82 | 82 |
| 83 void WebLayerImpl::setMaskLayer(WebLayer* maskLayer) { | 83 void WebLayerImpl::setMaskLayer(WebLayer* maskLayer) { |
| 84 layer_->setMaskLayer( | 84 layer_->SetMaskLayer( |
| 85 maskLayer ? static_cast<WebLayerImpl*>(maskLayer)->layer() : 0); | 85 maskLayer ? static_cast<WebLayerImpl*>(maskLayer)->layer() : 0); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void WebLayerImpl::setReplicaLayer(WebLayer* replica_layer) { | 88 void WebLayerImpl::setReplicaLayer(WebLayer* replica_layer) { |
| 89 layer_->setReplicaLayer( | 89 layer_->SetReplicaLayer( |
| 90 replica_layer ? static_cast<WebLayerImpl*>(replica_layer)->layer() : 0); | 90 replica_layer ? static_cast<WebLayerImpl*>(replica_layer)->layer() : 0); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void WebLayerImpl::setOpacity(float opacity) { layer_->setOpacity(opacity); } | 93 void WebLayerImpl::setOpacity(float opacity) { layer_->SetOpacity(opacity); } |
| 94 | 94 |
| 95 float WebLayerImpl::opacity() const { return layer_->opacity(); } | 95 float WebLayerImpl::opacity() const { return layer_->opacity(); } |
| 96 | 96 |
| 97 void WebLayerImpl::setOpaque(bool opaque) { layer_->setContentsOpaque(opaque); } | 97 void WebLayerImpl::setOpaque(bool opaque) { layer_->SetContentsOpaque(opaque); } |
| 98 | 98 |
| 99 bool WebLayerImpl::opaque() const { return layer_->contentsOpaque(); } | 99 bool WebLayerImpl::opaque() const { return layer_->contents_opaque(); } |
| 100 | 100 |
| 101 void WebLayerImpl::setPosition(const WebFloatPoint& position) { | 101 void WebLayerImpl::setPosition(const WebFloatPoint& position) { |
| 102 layer_->setPosition(position); | 102 layer_->SetPosition(position); |
| 103 } | 103 } |
| 104 | 104 |
| 105 WebFloatPoint WebLayerImpl::position() const { return layer_->position(); } | 105 WebFloatPoint WebLayerImpl::position() const { return layer_->position(); } |
| 106 | 106 |
| 107 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) { | 107 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) { |
| 108 gfx::Transform sub_layer_transform; | 108 gfx::Transform sub_layer_transform; |
| 109 sub_layer_transform.matrix() = matrix; | 109 sub_layer_transform.matrix() = matrix; |
| 110 layer_->setSublayerTransform(sub_layer_transform); | 110 layer_->SetSublayerTransform(sub_layer_transform); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) { | 113 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) { |
| 114 layer_->setSublayerTransform( | 114 layer_->SetSublayerTransform( |
| 115 WebTransformationMatrixUtil::ToTransform(matrix)); | 115 WebTransformationMatrixUtil::ToTransform(matrix)); |
| 116 } | 116 } |
| 117 | 117 |
| 118 SkMatrix44 WebLayerImpl::sublayerTransform() const { | 118 SkMatrix44 WebLayerImpl::sublayerTransform() const { |
| 119 return layer_->sublayerTransform().matrix(); | 119 return layer_->sublayer_transform().matrix(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void WebLayerImpl::setTransform(const SkMatrix44& matrix) { | 122 void WebLayerImpl::setTransform(const SkMatrix44& matrix) { |
| 123 gfx::Transform transform; | 123 gfx::Transform transform; |
| 124 transform.matrix() = matrix; | 124 transform.matrix() = matrix; |
| 125 layer_->setTransform(transform); | 125 layer_->SetTransform(transform); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix) { | 128 void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix) { |
| 129 layer_->setTransform(WebTransformationMatrixUtil::ToTransform(matrix)); | 129 layer_->SetTransform(WebTransformationMatrixUtil::ToTransform(matrix)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 SkMatrix44 WebLayerImpl::transform() const { | 132 SkMatrix44 WebLayerImpl::transform() const { |
| 133 return layer_->transform().matrix(); | 133 return layer_->transform().matrix(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void WebLayerImpl::setDrawsContent(bool draws_content) { | 136 void WebLayerImpl::setDrawsContent(bool draws_content) { |
| 137 layer_->setIsDrawable(draws_content); | 137 layer_->SetIsDrawable(draws_content); |
| 138 } | 138 } |
| 139 | 139 |
| 140 bool WebLayerImpl::drawsContent() const { return layer_->drawsContent(); } | 140 bool WebLayerImpl::drawsContent() const { return layer_->DrawsContent(); } |
| 141 | 141 |
| 142 void WebLayerImpl::setPreserves3D(bool preserve3D) { | 142 void WebLayerImpl::setPreserves3D(bool preserve3D) { |
| 143 layer_->setPreserves3D(preserve3D); | 143 layer_->SetPreserves3d(preserve3D); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void WebLayerImpl::setUseParentBackfaceVisibility( | 146 void WebLayerImpl::setUseParentBackfaceVisibility( |
| 147 bool use_parent_backface_visibility) { | 147 bool use_parent_backface_visibility) { |
| 148 layer_->setUseParentBackfaceVisibility(use_parent_backface_visibility); | 148 layer_->set_use_parent_backface_visibility(use_parent_backface_visibility); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void WebLayerImpl::setBackgroundColor(WebColor color) { | 151 void WebLayerImpl::setBackgroundColor(WebColor color) { |
| 152 layer_->setBackgroundColor(color); | 152 layer_->SetBackgroundColor(color); |
| 153 } | 153 } |
| 154 | 154 |
| 155 WebColor WebLayerImpl::backgroundColor() const { | 155 WebColor WebLayerImpl::backgroundColor() const { |
| 156 return layer_->backgroundColor(); | 156 return layer_->background_color(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void WebLayerImpl::setFilters(const WebFilterOperations& filters) { | 159 void WebLayerImpl::setFilters(const WebFilterOperations& filters) { |
| 160 layer_->setFilters(filters); | 160 layer_->SetFilters(filters); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void WebLayerImpl::setBackgroundFilters(const WebFilterOperations& filters) { | 163 void WebLayerImpl::setBackgroundFilters(const WebFilterOperations& filters) { |
| 164 layer_->setBackgroundFilters(filters); | 164 layer_->SetBackgroundFilters(filters); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void WebLayerImpl::setFilter(SkImageFilter* filter) { | 167 void WebLayerImpl::setFilter(SkImageFilter* filter) { |
| 168 SkSafeRef(filter); // Claim a reference for the compositor. | 168 SkSafeRef(filter); // Claim a reference for the compositor. |
| 169 layer_->setFilter(skia::AdoptRef(filter)); | 169 layer_->SetFilter(skia::AdoptRef(filter)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void WebLayerImpl::setDebugName(WebString name) { | 172 void WebLayerImpl::setDebugName(WebString name) { |
| 173 layer_->setDebugName(UTF16ToASCII(string16(name.data(), name.length()))); | 173 layer_->SetDebugName(UTF16ToASCII(string16(name.data(), name.length()))); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void WebLayerImpl::setAnimationDelegate(WebAnimationDelegate* delegate) { | 176 void WebLayerImpl::setAnimationDelegate(WebAnimationDelegate* delegate) { |
| 177 layer_->setLayerAnimationDelegate(delegate); | 177 layer_->set_layer_animation_delegate(delegate); |
| 178 } | 178 } |
| 179 | 179 |
| 180 bool WebLayerImpl::addAnimation(WebAnimation* animation) { | 180 bool WebLayerImpl::addAnimation(WebAnimation* animation) { |
| 181 return layer_->AddAnimation( | 181 return layer_->AddAnimation( |
| 182 static_cast<WebAnimationImpl*>(animation)->cloneToAnimation()); | 182 static_cast<WebAnimationImpl*>(animation)->cloneToAnimation()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void WebLayerImpl::removeAnimation(int animation_id) { | 185 void WebLayerImpl::removeAnimation(int animation_id) { |
| 186 layer_->RemoveAnimation(animation_id); | 186 layer_->RemoveAnimation(animation_id); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void WebLayerImpl::removeAnimation( | 189 void WebLayerImpl::removeAnimation( |
| 190 int animation_id, | 190 int animation_id, |
| 191 WebAnimation::TargetProperty target_property) { | 191 WebAnimation::TargetProperty target_property) { |
| 192 layer_->layerAnimationController()->RemoveAnimation( | 192 layer_->layer_animation_controller()->RemoveAnimation( |
| 193 animation_id, | 193 animation_id, |
| 194 static_cast<Animation::TargetProperty>(target_property)); | 194 static_cast<Animation::TargetProperty>(target_property)); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void WebLayerImpl::pauseAnimation(int animation_id, double time_offset) { | 197 void WebLayerImpl::pauseAnimation(int animation_id, double time_offset) { |
| 198 layer_->PauseAnimation(animation_id, time_offset); | 198 layer_->PauseAnimation(animation_id, time_offset); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void WebLayerImpl::suspendAnimations(double monotonic_time) { | 201 void WebLayerImpl::suspendAnimations(double monotonic_time) { |
| 202 layer_->suspendAnimations(monotonic_time); | 202 layer_->SuspendAnimations(monotonic_time); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void WebLayerImpl::resumeAnimations(double monotonic_time) { | 205 void WebLayerImpl::resumeAnimations(double monotonic_time) { |
| 206 layer_->resumeAnimations(monotonic_time); | 206 layer_->ResumeAnimations(monotonic_time); |
| 207 } | 207 } |
| 208 | 208 |
| 209 bool WebLayerImpl::hasActiveAnimation() { return layer_->hasActiveAnimation(); } | 209 bool WebLayerImpl::hasActiveAnimation() { return layer_->HasActiveAnimation(); } |
| 210 | 210 |
| 211 void WebLayerImpl::transferAnimationsTo(WebLayer* other) { | 211 void WebLayerImpl::transferAnimationsTo(WebLayer* other) { |
| 212 DCHECK(other); | 212 DCHECK(other); |
| 213 static_cast<WebLayerImpl*>(other)->layer_ | 213 static_cast<WebLayerImpl*>(other)->layer_->SetLayerAnimationController( |
| 214 ->setLayerAnimationController(layer_->releaseLayerAnimationController()); | 214 layer_->ReleaseLayerAnimationController()); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { | 217 void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { |
| 218 layer_->setForceRenderSurface(force_render_surface); | 218 layer_->SetForceRenderSurface(force_render_surface); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void WebLayerImpl::setScrollPosition(WebPoint position) { | 221 void WebLayerImpl::setScrollPosition(WebPoint position) { |
| 222 layer_->setScrollOffset(gfx::Point(position).OffsetFromOrigin()); | 222 layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); |
| 223 } | 223 } |
| 224 | 224 |
| 225 WebPoint WebLayerImpl::scrollPosition() const { | 225 WebPoint WebLayerImpl::scrollPosition() const { |
| 226 return gfx::PointAtOffsetFromOrigin(layer_->scrollOffset()); | 226 return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void WebLayerImpl::setMaxScrollPosition(WebSize max_scroll_position) { | 229 void WebLayerImpl::setMaxScrollPosition(WebSize max_scroll_position) { |
| 230 layer_->setMaxScrollOffset(max_scroll_position); | 230 layer_->SetMaxScrollOffset(max_scroll_position); |
| 231 } | 231 } |
| 232 | 232 |
| 233 WebSize WebLayerImpl::maxScrollPosition() const { | 233 WebSize WebLayerImpl::maxScrollPosition() const { |
| 234 return layer_->maxScrollOffset(); | 234 return layer_->max_scroll_offset(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void WebLayerImpl::setScrollable(bool scrollable) { | 237 void WebLayerImpl::setScrollable(bool scrollable) { |
| 238 layer_->setScrollable(scrollable); | 238 layer_->SetScrollable(scrollable); |
| 239 } | 239 } |
| 240 | 240 |
| 241 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } | 241 bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } |
| 242 | 242 |
| 243 void WebLayerImpl::setHaveWheelEventHandlers(bool have_wheel_event_handlers) { | 243 void WebLayerImpl::setHaveWheelEventHandlers(bool have_wheel_event_handlers) { |
| 244 layer_->setHaveWheelEventHandlers(have_wheel_event_handlers); | 244 layer_->SetHaveWheelEventHandlers(have_wheel_event_handlers); |
| 245 } | 245 } |
| 246 | 246 |
| 247 bool WebLayerImpl::haveWheelEventHandlers() const { | 247 bool WebLayerImpl::haveWheelEventHandlers() const { |
| 248 return layer_->haveWheelEventHandlers(); | 248 return layer_->have_wheel_event_handlers(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void WebLayerImpl::setShouldScrollOnMainThread( | 251 void WebLayerImpl::setShouldScrollOnMainThread( |
| 252 bool should_scroll_on_main_thread) { | 252 bool should_scroll_on_main_thread) { |
| 253 layer_->setShouldScrollOnMainThread(should_scroll_on_main_thread); | 253 layer_->SetShouldScrollOnMainThread(should_scroll_on_main_thread); |
| 254 } | 254 } |
| 255 | 255 |
| 256 bool WebLayerImpl::shouldScrollOnMainThread() const { | 256 bool WebLayerImpl::shouldScrollOnMainThread() const { |
| 257 return layer_->shouldScrollOnMainThread(); | 257 return layer_->should_scroll_on_main_thread(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects) { | 260 void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects) { |
| 261 cc::Region region; | 261 cc::Region region; |
| 262 for (size_t i = 0; i < rects.size(); ++i) | 262 for (size_t i = 0; i < rects.size(); ++i) |
| 263 region.Union(rects[i]); | 263 region.Union(rects[i]); |
| 264 layer_->setNonFastScrollableRegion(region); | 264 layer_->SetNonFastScrollableRegion(region); |
| 265 } | 265 } |
| 266 | 266 |
| 267 WebVector<WebRect> WebLayerImpl::nonFastScrollableRegion() const { | 267 WebVector<WebRect> WebLayerImpl::nonFastScrollableRegion() const { |
| 268 size_t num_rects = 0; | 268 size_t num_rects = 0; |
| 269 for (cc::Region::Iterator region_rects(layer_->nonFastScrollableRegion()); | 269 for (cc::Region::Iterator region_rects(layer_->non_fast_scrollable_region()); |
| 270 region_rects.has_rect(); | 270 region_rects.has_rect(); |
| 271 region_rects.next()) | 271 region_rects.next()) |
| 272 ++num_rects; | 272 ++num_rects; |
| 273 | 273 |
| 274 WebVector<WebRect> result(num_rects); | 274 WebVector<WebRect> result(num_rects); |
| 275 size_t i = 0; | 275 size_t i = 0; |
| 276 for (cc::Region::Iterator region_rects(layer_->nonFastScrollableRegion()); | 276 for (cc::Region::Iterator region_rects(layer_->non_fast_scrollable_region()); |
| 277 region_rects.has_rect(); | 277 region_rects.has_rect(); |
| 278 region_rects.next()) { | 278 region_rects.next()) { |
| 279 result[i] = region_rects.rect(); | 279 result[i] = region_rects.rect(); |
| 280 ++i; | 280 ++i; |
| 281 } | 281 } |
| 282 return result; | 282 return result; |
| 283 } | 283 } |
| 284 | 284 |
| 285 void WebLayerImpl::setTouchEventHandlerRegion(const WebVector<WebRect>& rects) { | 285 void WebLayerImpl::setTouchEventHandlerRegion(const WebVector<WebRect>& rects) { |
| 286 cc::Region region; | 286 cc::Region region; |
| 287 for (size_t i = 0; i < rects.size(); ++i) | 287 for (size_t i = 0; i < rects.size(); ++i) |
| 288 region.Union(rects[i]); | 288 region.Union(rects[i]); |
| 289 layer_->setTouchEventHandlerRegion(region); | 289 layer_->SetTouchEventHandlerRegion(region); |
| 290 } | 290 } |
| 291 | 291 |
| 292 WebVector<WebRect> WebLayerImpl::touchEventHandlerRegion() const { | 292 WebVector<WebRect> WebLayerImpl::touchEventHandlerRegion() const { |
| 293 size_t num_rects = 0; | 293 size_t num_rects = 0; |
| 294 for (cc::Region::Iterator region_rects(layer_->touchEventHandlerRegion()); | 294 for (cc::Region::Iterator region_rects(layer_->touch_event_handler_region()); |
| 295 region_rects.has_rect(); | 295 region_rects.has_rect(); |
| 296 region_rects.next()) | 296 region_rects.next()) |
| 297 ++num_rects; | 297 ++num_rects; |
| 298 | 298 |
| 299 WebVector<WebRect> result(num_rects); | 299 WebVector<WebRect> result(num_rects); |
| 300 size_t i = 0; | 300 size_t i = 0; |
| 301 for (cc::Region::Iterator region_rects(layer_->touchEventHandlerRegion()); | 301 for (cc::Region::Iterator region_rects(layer_->touch_event_handler_region()); |
| 302 region_rects.has_rect(); | 302 region_rects.has_rect(); |
| 303 region_rects.next()) { | 303 region_rects.next()) { |
| 304 result[i] = region_rects.rect(); | 304 result[i] = region_rects.rect(); |
| 305 ++i; | 305 ++i; |
| 306 } | 306 } |
| 307 return result; | 307 return result; |
| 308 } | 308 } |
| 309 | 309 |
| 310 void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) { | 310 void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) { |
| 311 layer_->setIsContainerForFixedPositionLayers(enable); | 311 layer_->SetIsContainerForFixedPositionLayers(enable); |
| 312 } | 312 } |
| 313 | 313 |
| 314 bool WebLayerImpl::isContainerForFixedPositionLayers() const { | 314 bool WebLayerImpl::isContainerForFixedPositionLayers() const { |
| 315 return layer_->isContainerForFixedPositionLayers(); | 315 return layer_->is_container_for_fixed_position_layers(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void WebLayerImpl::setFixedToContainerLayer(bool enable) { | 318 void WebLayerImpl::setFixedToContainerLayer(bool enable) { |
| 319 layer_->setFixedToContainerLayer(enable); | 319 layer_->SetFixedToContainerLayer(enable); |
| 320 } | 320 } |
| 321 | 321 |
| 322 bool WebLayerImpl::fixedToContainerLayer() const { | 322 bool WebLayerImpl::fixedToContainerLayer() const { |
| 323 return layer_->fixedToContainerLayer(); | 323 return layer_->fixed_to_container_layer(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 void WebLayerImpl::setScrollClient(WebLayerScrollClient* scroll_client) { | 326 void WebLayerImpl::setScrollClient(WebLayerScrollClient* scroll_client) { |
| 327 layer_->setLayerScrollClient(scroll_client); | 327 layer_->set_layer_scroll_client(scroll_client); |
| 328 } | 328 } |
| 329 | 329 |
| 330 Layer* WebLayerImpl::layer() const { return layer_.get(); } | 330 Layer* WebLayerImpl::layer() const { return layer_.get(); } |
| 331 | 331 |
| 332 } // namespace WebKit | 332 } // namespace WebKit |
| OLD | NEW |