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 "config.h" | 5 #include "config.h" |
6 #include "WebLayerImpl.h" | 6 #include "WebLayerImpl.h" |
7 | 7 |
8 #include "CCActiveAnimation.h" | 8 #include "CCActiveAnimation.h" |
9 #include "LayerChromium.h" | 9 #include "LayerChromium.h" |
10 #include "SkMatrix44.h" | 10 #include "SkMatrix44.h" |
11 #include "WebAnimationImpl.h" | 11 #include "WebAnimationImpl.h" |
12 #ifdef LOG | 12 #ifdef LOG |
13 #undef LOG | 13 #undef LOG |
14 #endif | 14 #endif |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "webcore_convert.h" |
16 #include <public/WebFloatPoint.h> | 17 #include <public/WebFloatPoint.h> |
17 #include <public/WebFloatRect.h> | 18 #include <public/WebFloatRect.h> |
18 #include <public/WebSize.h> | 19 #include <public/WebSize.h> |
19 #include <public/WebTransformationMatrix.h> | 20 #include <public/WebTransformationMatrix.h> |
20 | 21 |
21 using WebCore::CCActiveAnimation; | 22 using WebCore::CCActiveAnimation; |
22 using WebCore::LayerChromium; | 23 using WebCore::LayerChromium; |
23 | 24 |
24 namespace WebKit { | 25 namespace WebKit { |
25 | 26 |
(...skipping 24 matching lines...) Expand all Loading... |
50 skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32())); | 51 skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32())); |
51 skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33())); | 52 skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33())); |
52 skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34())); | 53 skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34())); |
53 skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41())); | 54 skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41())); |
54 skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42())); | 55 skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42())); |
55 skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43())); | 56 skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43())); |
56 skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44())); | 57 skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44())); |
57 return skMatrix; | 58 return skMatrix; |
58 } | 59 } |
59 | 60 |
60 } // anonymous namespace | 61 } |
61 | |
62 | 62 |
63 WebLayer* WebLayer::create() | 63 WebLayer* WebLayer::create() |
64 { | 64 { |
65 return new WebLayerImpl(); | 65 return new WebLayerImpl(); |
66 } | 66 } |
67 | 67 |
68 WebLayerImpl::WebLayerImpl() | 68 WebLayerImpl::WebLayerImpl() |
69 : m_layer(LayerChromium::create()) | 69 : m_layer(LayerChromium::create()) |
70 { | 70 { |
71 } | 71 } |
(...skipping 10 matching lines...) Expand all Loading... |
82 m_layer->setLayerAnimationDelegate(0); | 82 m_layer->setLayerAnimationDelegate(0); |
83 } | 83 } |
84 | 84 |
85 int WebLayerImpl::id() const | 85 int WebLayerImpl::id() const |
86 { | 86 { |
87 return m_layer->id(); | 87 return m_layer->id(); |
88 } | 88 } |
89 | 89 |
90 void WebLayerImpl::invalidateRect(const WebFloatRect& rect) | 90 void WebLayerImpl::invalidateRect(const WebFloatRect& rect) |
91 { | 91 { |
92 m_layer->setNeedsDisplayRect(rect); | 92 m_layer->setNeedsDisplayRect(convert(rect)); |
93 } | 93 } |
94 | 94 |
95 void WebLayerImpl::invalidate() | 95 void WebLayerImpl::invalidate() |
96 { | 96 { |
97 m_layer->setNeedsDisplay(); | 97 m_layer->setNeedsDisplay(); |
98 } | 98 } |
99 | 99 |
100 void WebLayerImpl::addChild(WebLayer* child) | 100 void WebLayerImpl::addChild(WebLayer* child) |
101 { | 101 { |
102 m_layer->addChild(static_cast<WebLayerImpl*>(child)->layer()); | 102 m_layer->addChild(static_cast<WebLayerImpl*>(child)->layer()); |
(...skipping 14 matching lines...) Expand all Loading... |
117 m_layer->removeFromParent(); | 117 m_layer->removeFromParent(); |
118 } | 118 } |
119 | 119 |
120 void WebLayerImpl::removeAllChildren() | 120 void WebLayerImpl::removeAllChildren() |
121 { | 121 { |
122 m_layer->removeAllChildren(); | 122 m_layer->removeAllChildren(); |
123 } | 123 } |
124 | 124 |
125 void WebLayerImpl::setAnchorPoint(const WebFloatPoint& anchorPoint) | 125 void WebLayerImpl::setAnchorPoint(const WebFloatPoint& anchorPoint) |
126 { | 126 { |
127 m_layer->setAnchorPoint(anchorPoint); | 127 m_layer->setAnchorPoint(convert(anchorPoint)); |
128 } | 128 } |
129 | 129 |
130 WebFloatPoint WebLayerImpl::anchorPoint() const | 130 WebFloatPoint WebLayerImpl::anchorPoint() const |
131 { | 131 { |
132 return WebFloatPoint(m_layer->anchorPoint()); | 132 return WebFloatPoint(m_layer->anchorPoint().x(), m_layer->anchorPoint().y())
; |
133 } | 133 } |
134 | 134 |
135 void WebLayerImpl::setAnchorPointZ(float anchorPointZ) | 135 void WebLayerImpl::setAnchorPointZ(float anchorPointZ) |
136 { | 136 { |
137 m_layer->setAnchorPointZ(anchorPointZ); | 137 m_layer->setAnchorPointZ(anchorPointZ); |
138 } | 138 } |
139 | 139 |
140 float WebLayerImpl::anchorPointZ() const | 140 float WebLayerImpl::anchorPointZ() const |
141 { | 141 { |
142 return m_layer->anchorPointZ(); | 142 return m_layer->anchorPointZ(); |
143 } | 143 } |
144 | 144 |
145 void WebLayerImpl::setBounds(const WebSize& size) | 145 void WebLayerImpl::setBounds(const WebSize& size) |
146 { | 146 { |
147 m_layer->setBounds(size); | 147 m_layer->setBounds(convert(size)); |
148 } | 148 } |
149 | 149 |
150 WebSize WebLayerImpl::bounds() const | 150 WebSize WebLayerImpl::bounds() const |
151 { | 151 { |
152 return WebSize(m_layer->bounds()); | 152 return convert(m_layer->bounds()); |
153 } | 153 } |
154 | 154 |
155 void WebLayerImpl::setMasksToBounds(bool masksToBounds) | 155 void WebLayerImpl::setMasksToBounds(bool masksToBounds) |
156 { | 156 { |
157 m_layer->setMasksToBounds(masksToBounds); | 157 m_layer->setMasksToBounds(masksToBounds); |
158 } | 158 } |
159 | 159 |
160 bool WebLayerImpl::masksToBounds() const | 160 bool WebLayerImpl::masksToBounds() const |
161 { | 161 { |
162 return m_layer->masksToBounds(); | 162 return m_layer->masksToBounds(); |
(...skipping 24 matching lines...) Expand all Loading... |
187 m_layer->setOpaque(opaque); | 187 m_layer->setOpaque(opaque); |
188 } | 188 } |
189 | 189 |
190 bool WebLayerImpl::opaque() const | 190 bool WebLayerImpl::opaque() const |
191 { | 191 { |
192 return m_layer->opaque(); | 192 return m_layer->opaque(); |
193 } | 193 } |
194 | 194 |
195 void WebLayerImpl::setPosition(const WebFloatPoint& position) | 195 void WebLayerImpl::setPosition(const WebFloatPoint& position) |
196 { | 196 { |
197 m_layer->setPosition(position); | 197 m_layer->setPosition(convert(position)); |
198 } | 198 } |
199 | 199 |
200 WebFloatPoint WebLayerImpl::position() const | 200 WebFloatPoint WebLayerImpl::position() const |
201 { | 201 { |
202 return WebFloatPoint(m_layer->position()); | 202 return WebFloatPoint(m_layer->position().x(), m_layer->position().y()); |
203 } | 203 } |
204 | 204 |
205 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) | 205 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) |
206 { | 206 { |
207 m_layer->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix)); | 207 m_layer->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix)); |
208 } | 208 } |
209 | 209 |
210 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) | 210 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) |
211 { | 211 { |
212 m_layer->setSublayerTransform(matrix); | 212 m_layer->setSublayerTransform(matrix); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 static_cast<WebLayerImpl*>(other)->m_layer->setLayerAnimationController(m_la
yer->releaseLayerAnimationController()); | 328 static_cast<WebLayerImpl*>(other)->m_layer->setLayerAnimationController(m_la
yer->releaseLayerAnimationController()); |
329 } | 329 } |
330 | 330 |
331 void WebLayerImpl::setForceRenderSurface(bool forceRenderSurface) | 331 void WebLayerImpl::setForceRenderSurface(bool forceRenderSurface) |
332 { | 332 { |
333 m_layer->setForceRenderSurface(forceRenderSurface); | 333 m_layer->setForceRenderSurface(forceRenderSurface); |
334 } | 334 } |
335 | 335 |
336 void WebLayerImpl::setScrollPosition(WebPoint position) | 336 void WebLayerImpl::setScrollPosition(WebPoint position) |
337 { | 337 { |
338 m_layer->setScrollPosition(position); | 338 m_layer->setScrollPosition(convert(position)); |
339 } | 339 } |
340 | 340 |
341 WebPoint WebLayerImpl::scrollPosition() const | 341 WebPoint WebLayerImpl::scrollPosition() const |
342 { | 342 { |
343 return m_layer->scrollPosition(); | 343 return WebPoint(m_layer->scrollPosition().x(), m_layer->scrollPosition().y()
); |
344 } | 344 } |
345 | 345 |
346 void WebLayerImpl::setMaxScrollPosition(WebSize maxScrollPosition) | 346 void WebLayerImpl::setMaxScrollPosition(WebSize maxScrollPosition) |
347 { | 347 { |
348 m_layer->setMaxScrollPosition(maxScrollPosition); | 348 m_layer->setMaxScrollPosition(convert(maxScrollPosition)); |
349 } | 349 } |
350 | 350 |
351 void WebLayerImpl::setScrollable(bool scrollable) | 351 void WebLayerImpl::setScrollable(bool scrollable) |
352 { | 352 { |
353 m_layer->setScrollable(scrollable); | 353 m_layer->setScrollable(scrollable); |
354 } | 354 } |
355 | 355 |
356 void WebLayerImpl::setHaveWheelEventHandlers(bool haveWheelEventHandlers) | 356 void WebLayerImpl::setHaveWheelEventHandlers(bool haveWheelEventHandlers) |
357 { | 357 { |
358 m_layer->setHaveWheelEventHandlers(haveWheelEventHandlers); | 358 m_layer->setHaveWheelEventHandlers(haveWheelEventHandlers); |
359 } | 359 } |
360 | 360 |
361 void WebLayerImpl::setShouldScrollOnMainThread(bool shouldScrollOnMainThread) | 361 void WebLayerImpl::setShouldScrollOnMainThread(bool shouldScrollOnMainThread) |
362 { | 362 { |
363 m_layer->setShouldScrollOnMainThread(shouldScrollOnMainThread); | 363 m_layer->setShouldScrollOnMainThread(shouldScrollOnMainThread); |
364 } | 364 } |
365 | 365 |
366 void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects) | 366 void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects) |
367 { | 367 { |
368 WebCore::Region region; | 368 WebCore::Region region; |
369 for (size_t i = 0; i < rects.size(); ++i) { | 369 for (size_t i = 0; i < rects.size(); ++i) { |
370 WebCore::IntRect rect = rects[i]; | 370 WebCore::IntRect rect = convert(rects[i]); |
371 region.unite(rect); | 371 region.unite(rect); |
372 } | 372 } |
373 m_layer->setNonFastScrollableRegion(region); | 373 m_layer->setNonFastScrollableRegion(region); |
374 | 374 |
375 } | 375 } |
376 | 376 |
377 void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) | 377 void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) |
378 { | 378 { |
379 m_layer->setIsContainerForFixedPositionLayers(enable); | 379 m_layer->setIsContainerForFixedPositionLayers(enable); |
380 } | 380 } |
381 | 381 |
382 void WebLayerImpl::setFixedToContainerLayer(bool enable) | 382 void WebLayerImpl::setFixedToContainerLayer(bool enable) |
383 { | 383 { |
384 m_layer->setFixedToContainerLayer(enable); | 384 m_layer->setFixedToContainerLayer(enable); |
385 } | 385 } |
386 | 386 |
387 void WebLayerImpl::setScrollClient(WebLayerScrollClient* scrollClient) | 387 void WebLayerImpl::setScrollClient(WebLayerScrollClient* scrollClient) |
388 { | 388 { |
389 m_layer->setLayerScrollClient(scrollClient); | 389 m_layer->setLayerScrollClient(scrollClient); |
390 } | 390 } |
391 | 391 |
392 LayerChromium* WebLayerImpl::layer() const | 392 LayerChromium* WebLayerImpl::layer() const |
393 { | 393 { |
394 return m_layer.get(); | 394 return m_layer.get(); |
395 } | 395 } |
396 | 396 |
397 } // namespace WebKit | 397 } // namespace WebKit |
OLD | NEW |