| 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 "web_layer_impl.h" | 6 #include "web_layer_impl.h" |
| 7 | 7 |
| 8 #include "Region.h" | |
| 9 #include "SkMatrix44.h" | 8 #include "SkMatrix44.h" |
| 10 #ifdef LOG | 9 #ifdef LOG |
| 11 #undef LOG | 10 #undef LOG |
| 12 #endif | 11 #endif |
| 13 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 14 #include "cc/active_animation.h" | 13 #include "cc/active_animation.h" |
| 15 #include "cc/layer.h" | 14 #include "cc/layer.h" |
| 15 #include "cc/region.h" |
| 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
| 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
| 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa
trix.h" | 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa
trix.h" |
| 20 #include "web_animation_impl.h" | 20 #include "web_animation_impl.h" |
| 21 | 21 |
| 22 using cc::ActiveAnimation; | 22 using cc::ActiveAnimation; |
| 23 using cc::Layer; | 23 using cc::Layer; |
| 24 | 24 |
| 25 namespace WebKit { | 25 namespace WebKit { |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects) | 396 void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects) |
| 397 { | 397 { |
| 398 cc::Region region; | 398 cc::Region region; |
| 399 for (size_t i = 0; i < rects.size(); ++i) | 399 for (size_t i = 0; i < rects.size(); ++i) |
| 400 region.Union(rects[i]); | 400 region.Union(rects[i]); |
| 401 m_layer->setNonFastScrollableRegion(region); | 401 m_layer->setNonFastScrollableRegion(region); |
| 402 } | 402 } |
| 403 | 403 |
| 404 WebVector<WebRect> WebLayerImpl::nonFastScrollableRegion() const | 404 WebVector<WebRect> WebLayerImpl::nonFastScrollableRegion() const |
| 405 { | 405 { |
| 406 cc::Region::Iterator regionRects(m_layer->nonFastScrollableRegion()); | 406 size_t numRects = 0; |
| 407 WebVector<WebRect> result(regionRects.size()); | 407 for (cc::Region::Iterator regionRects(m_layer->nonFastScrollableRegion()); r
egionRects.has_rect(); regionRects.next()) |
| 408 for (size_t i = 0; regionRects.has_rect(); regionRects.next(), ++i) | 408 ++numRects; |
| 409 |
| 410 WebVector<WebRect> result(numRects); |
| 411 size_t i = 0; |
| 412 for (cc::Region::Iterator regionRects(m_layer->nonFastScrollableRegion()); r
egionRects.has_rect(); regionRects.next()) { |
| 409 result[i] = regionRects.rect(); | 413 result[i] = regionRects.rect(); |
| 414 ++i; |
| 415 } |
| 410 return result; | 416 return result; |
| 411 } | 417 } |
| 412 | 418 |
| 413 void WebLayerImpl::setTouchEventHandlerRegion(const WebVector<WebRect>& rects) | 419 void WebLayerImpl::setTouchEventHandlerRegion(const WebVector<WebRect>& rects) |
| 414 { | 420 { |
| 415 cc::Region region; | 421 cc::Region region; |
| 416 for (size_t i = 0; i < rects.size(); ++i) | 422 for (size_t i = 0; i < rects.size(); ++i) |
| 417 region.Union(rects[i]); | 423 region.Union(rects[i]); |
| 418 m_layer->setTouchEventHandlerRegion(region); | 424 m_layer->setTouchEventHandlerRegion(region); |
| 419 | |
| 420 } | 425 } |
| 421 | 426 |
| 422 WebVector<WebRect> WebLayerImpl::touchEventHandlerRegion() const | 427 WebVector<WebRect> WebLayerImpl::touchEventHandlerRegion() const |
| 423 { | 428 { |
| 424 cc::Region::Iterator regionRects(m_layer->touchEventHandlerRegion()); | 429 size_t numRects = 0; |
| 425 WebVector<WebRect> result(regionRects.size()); | 430 for (cc::Region::Iterator regionRects(m_layer->touchEventHandlerRegion()); r
egionRects.has_rect(); regionRects.next()) |
| 426 for (size_t i = 0; regionRects.has_rect(); regionRects.next(), ++i) | 431 ++numRects; |
| 427 result[i] = regionRects.rect(); | 432 |
| 428 return result; | 433 |
| 434 WebVector<WebRect> result(numRects); |
| 435 size_t i = 0; |
| 436 for (cc::Region::Iterator regionRects(m_layer->touchEventHandlerRegion()); r
egionRects.has_rect(); regionRects.next()) { |
| 437 result[i] = regionRects.rect(); |
| 438 ++i; |
| 439 } |
| 440 return result; |
| 429 } | 441 } |
| 430 | 442 |
| 431 void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) | 443 void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) |
| 432 { | 444 { |
| 433 m_layer->setIsContainerForFixedPositionLayers(enable); | 445 m_layer->setIsContainerForFixedPositionLayers(enable); |
| 434 } | 446 } |
| 435 | 447 |
| 436 bool WebLayerImpl::isContainerForFixedPositionLayers() const | 448 bool WebLayerImpl::isContainerForFixedPositionLayers() const |
| 437 { | 449 { |
| 438 return m_layer->isContainerForFixedPositionLayers(); | 450 return m_layer->isContainerForFixedPositionLayers(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 452 { | 464 { |
| 453 m_layer->setLayerScrollClient(scrollClient); | 465 m_layer->setLayerScrollClient(scrollClient); |
| 454 } | 466 } |
| 455 | 467 |
| 456 Layer* WebLayerImpl::layer() const | 468 Layer* WebLayerImpl::layer() const |
| 457 { | 469 { |
| 458 return m_layer.get(); | 470 return m_layer.get(); |
| 459 } | 471 } |
| 460 | 472 |
| 461 } // namespace WebKit | 473 } // namespace WebKit |
| OLD | NEW |