OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 | 6 |
7 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
8 #include "LayerChromium.h" | 8 #include "LayerChromium.h" |
9 | 9 |
10 #include "CCActiveAnimation.h" | 10 #include "CCActiveAnimation.h" |
11 #include "CCAnimationEvents.h" | 11 #include "CCAnimationEvents.h" |
12 #include "CCLayerAnimationController.h" | 12 #include "CCLayerAnimationController.h" |
13 #include "CCLayerImpl.h" | 13 #include "CCLayerImpl.h" |
14 #include "CCLayerTreeHost.h" | 14 #include "CCLayerTreeHost.h" |
15 #include "CCSettings.h" | 15 #include "CCSettings.h" |
16 #include "TextStream.h" | 16 #include "TextStream.h" |
17 | 17 |
18 #include <public/WebAnimationDelegate.h> | 18 #include <public/WebAnimationDelegate.h> |
| 19 #include <public/WebLayerScrollClient.h> |
| 20 #include <public/WebSize.h> |
19 | 21 |
20 using namespace std; | 22 using namespace std; |
21 using WebKit::WebTransformationMatrix; | 23 using WebKit::WebTransformationMatrix; |
22 | 24 |
23 namespace WebCore { | 25 namespace WebCore { |
24 | 26 |
25 static int s_nextLayerId = 1; | 27 static int s_nextLayerId = 1; |
26 | 28 |
27 PassRefPtr<LayerChromium> LayerChromium::create() | 29 PassRefPtr<LayerChromium> LayerChromium::create() |
28 { | 30 { |
(...skipping 29 matching lines...) Expand all Loading... |
58 , m_drawCheckerboardForMissingTiles(false) | 60 , m_drawCheckerboardForMissingTiles(false) |
59 , m_forceRenderSurface(false) | 61 , m_forceRenderSurface(false) |
60 , m_replicaLayer(0) | 62 , m_replicaLayer(0) |
61 , m_drawOpacity(0) | 63 , m_drawOpacity(0) |
62 , m_drawOpacityIsAnimating(false) | 64 , m_drawOpacityIsAnimating(false) |
63 , m_renderTarget(0) | 65 , m_renderTarget(0) |
64 , m_drawTransformIsAnimating(false) | 66 , m_drawTransformIsAnimating(false) |
65 , m_screenSpaceTransformIsAnimating(false) | 67 , m_screenSpaceTransformIsAnimating(false) |
66 , m_contentsScale(1.0) | 68 , m_contentsScale(1.0) |
67 , m_layerAnimationDelegate(0) | 69 , m_layerAnimationDelegate(0) |
68 , m_layerScrollDelegate(0) | 70 , m_layerScrollClient(0) |
69 { | 71 { |
70 if (m_layerId < 0) { | 72 if (m_layerId < 0) { |
71 s_nextLayerId = 1; | 73 s_nextLayerId = 1; |
72 m_layerId = s_nextLayerId++; | 74 m_layerId = s_nextLayerId++; |
73 } | 75 } |
74 } | 76 } |
75 | 77 |
76 LayerChromium::~LayerChromium() | 78 LayerChromium::~LayerChromium() |
77 { | 79 { |
78 // Our parent should be holding a reference to us so there should be no | 80 // Our parent should be holding a reference to us so there should be no |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 bool LayerChromium::transformIsAnimating() const | 364 bool LayerChromium::transformIsAnimating() const |
363 { | 365 { |
364 return m_layerAnimationController->isAnimatingProperty(CCActiveAnimation::Tr
ansform); | 366 return m_layerAnimationController->isAnimatingProperty(CCActiveAnimation::Tr
ansform); |
365 } | 367 } |
366 | 368 |
367 void LayerChromium::setScrollPosition(const IntPoint& scrollPosition) | 369 void LayerChromium::setScrollPosition(const IntPoint& scrollPosition) |
368 { | 370 { |
369 if (m_scrollPosition == scrollPosition) | 371 if (m_scrollPosition == scrollPosition) |
370 return; | 372 return; |
371 m_scrollPosition = scrollPosition; | 373 m_scrollPosition = scrollPosition; |
| 374 if (m_layerScrollClient) |
| 375 m_layerScrollClient->didScroll(); |
372 setNeedsCommit(); | 376 setNeedsCommit(); |
373 } | 377 } |
374 | 378 |
375 void LayerChromium::setMaxScrollPosition(const IntSize& maxScrollPosition) | 379 void LayerChromium::setMaxScrollPosition(const IntSize& maxScrollPosition) |
376 { | 380 { |
377 if (m_maxScrollPosition == maxScrollPosition) | 381 if (m_maxScrollPosition == maxScrollPosition) |
378 return; | 382 return; |
379 m_maxScrollPosition = maxScrollPosition; | 383 m_maxScrollPosition = maxScrollPosition; |
380 setNeedsCommit(); | 384 setNeedsCommit(); |
381 } | 385 } |
(...skipping 24 matching lines...) Expand all Loading... |
406 | 410 |
407 void LayerChromium::setNonFastScrollableRegion(const Region& region) | 411 void LayerChromium::setNonFastScrollableRegion(const Region& region) |
408 { | 412 { |
409 if (m_nonFastScrollableRegion == region) | 413 if (m_nonFastScrollableRegion == region) |
410 return; | 414 return; |
411 m_nonFastScrollableRegion = region; | 415 m_nonFastScrollableRegion = region; |
412 m_nonFastScrollableRegionChanged = true; | 416 m_nonFastScrollableRegionChanged = true; |
413 setNeedsCommit(); | 417 setNeedsCommit(); |
414 } | 418 } |
415 | 419 |
416 void LayerChromium::scrollBy(const IntSize& scrollDelta) | |
417 { | |
418 setScrollPosition(scrollPosition() + scrollDelta); | |
419 if (m_layerScrollDelegate) | |
420 m_layerScrollDelegate->didScroll(scrollDelta); | |
421 } | |
422 | |
423 void LayerChromium::setDrawCheckerboardForMissingTiles(bool checkerboard) | 420 void LayerChromium::setDrawCheckerboardForMissingTiles(bool checkerboard) |
424 { | 421 { |
425 if (m_drawCheckerboardForMissingTiles == checkerboard) | 422 if (m_drawCheckerboardForMissingTiles == checkerboard) |
426 return; | 423 return; |
427 m_drawCheckerboardForMissingTiles = checkerboard; | 424 m_drawCheckerboardForMissingTiles = checkerboard; |
428 setNeedsCommit(); | 425 setNeedsCommit(); |
429 } | 426 } |
430 | 427 |
431 void LayerChromium::setForceRenderSurface(bool force) | 428 void LayerChromium::setForceRenderSurface(bool force) |
432 { | 429 { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 return Region(); | 705 return Region(); |
709 } | 706 } |
710 | 707 |
711 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr
omium> >::iterator, void*) | 708 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr
omium> >::iterator, void*) |
712 { | 709 { |
713 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. | 710 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. |
714 } | 711 } |
715 | 712 |
716 } | 713 } |
717 #endif // USE(ACCELERATED_COMPOSITING) | 714 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |