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 | 6 |
7 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
8 | 8 |
9 #include "CCLayerImpl.h" | 9 #include "CCLayerImpl.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 , m_opaque(false) | 40 , m_opaque(false) |
41 , m_opacity(1.0) | 41 , m_opacity(1.0) |
42 , m_preserves3D(false) | 42 , m_preserves3D(false) |
43 , m_useParentBackfaceVisibility(false) | 43 , m_useParentBackfaceVisibility(false) |
44 , m_drawCheckerboardForMissingTiles(false) | 44 , m_drawCheckerboardForMissingTiles(false) |
45 , m_useLCDText(false) | 45 , m_useLCDText(false) |
46 , m_drawsContent(false) | 46 , m_drawsContent(false) |
47 , m_forceRenderSurface(false) | 47 , m_forceRenderSurface(false) |
48 , m_isContainerForFixedPositionLayers(false) | 48 , m_isContainerForFixedPositionLayers(false) |
49 , m_fixedToContainerLayer(false) | 49 , m_fixedToContainerLayer(false) |
50 , m_pageScaleDelta(1) | |
51 , m_renderTarget(0) | 50 , m_renderTarget(0) |
52 , m_drawDepth(0) | 51 , m_drawDepth(0) |
53 , m_drawOpacity(0) | 52 , m_drawOpacity(0) |
54 , m_drawOpacityIsAnimating(false) | 53 , m_drawOpacityIsAnimating(false) |
55 , m_debugBorderColor(0) | 54 , m_debugBorderColor(0) |
56 , m_debugBorderWidth(0) | 55 , m_debugBorderWidth(0) |
57 , m_drawTransformIsAnimating(false) | 56 , m_drawTransformIsAnimating(false) |
58 , m_screenSpaceTransformIsAnimating(false) | 57 , m_screenSpaceTransformIsAnimating(false) |
59 #ifndef NDEBUG | 58 #ifndef NDEBUG |
60 , m_betweenWillDrawAndDidDraw(false) | 59 , m_betweenWillDrawAndDidDraw(false) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 { | 166 { |
168 return CCRenderPass::Id(0, 0); | 167 return CCRenderPass::Id(0, 0); |
169 } | 168 } |
170 | 169 |
171 CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const | 170 CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const |
172 { | 171 { |
173 ASSERT_NOT_REACHED(); | 172 ASSERT_NOT_REACHED(); |
174 return 0; | 173 return 0; |
175 } | 174 } |
176 | 175 |
177 void CCLayerImpl::scrollBy(const FloatSize& scroll) | 176 FloatSize CCLayerImpl::scrollBy(const FloatSize& scroll) |
178 { | 177 { |
179 IntSize minDelta = -toSize(m_scrollPosition); | 178 IntSize minDelta = -toSize(m_scrollPosition); |
180 IntSize maxDelta = m_maxScrollPosition - toSize(m_scrollPosition); | 179 IntSize maxDelta = m_maxScrollPosition - toSize(m_scrollPosition); |
181 // Clamp newDelta so that position + delta stays within scroll bounds. | 180 // Clamp newDelta so that position + delta stays within scroll bounds. |
182 FloatSize newDelta = (m_scrollDelta + scroll).expandedTo(minDelta).shrunkTo(
maxDelta); | 181 FloatSize newDelta = (m_scrollDelta + scroll).expandedTo(minDelta).shrunkTo(
maxDelta); |
| 182 FloatSize unscrolled = m_scrollDelta + scroll - newDelta; |
183 | 183 |
184 if (m_scrollDelta == newDelta) | 184 if (m_scrollDelta == newDelta) |
185 return; | 185 return unscrolled; |
186 | 186 |
187 m_scrollDelta = newDelta; | 187 m_scrollDelta = newDelta; |
188 if (m_scrollbarAnimationController) | 188 if (m_scrollbarAnimationController) |
189 m_scrollbarAnimationController->updateScrollOffset(this); | 189 m_scrollbarAnimationController->updateScrollOffset(this); |
190 noteLayerPropertyChangedForSubtree(); | 190 noteLayerPropertyChangedForSubtree(); |
| 191 |
| 192 return unscrolled; |
191 } | 193 } |
192 | 194 |
193 CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& viewpo
rtPoint, CCInputHandlerClient::ScrollInputType type) const | 195 CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& viewpo
rtPoint, CCInputHandlerClient::ScrollInputType type) const |
194 { | 196 { |
195 if (shouldScrollOnMainThread()) { | 197 if (shouldScrollOnMainThread()) { |
196 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed shouldScrollOnMainThr
ead"); | 198 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed shouldScrollOnMainThr
ead"); |
197 return CCInputHandlerClient::ScrollOnMainThread; | 199 return CCInputHandlerClient::ScrollOnMainThread; |
198 } | 200 } |
199 | 201 |
200 if (!screenSpaceTransform().isInvertible()) { | 202 if (!screenSpaceTransform().isInvertible()) { |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 602 |
601 void CCLayerImpl::setScrollDelta(const FloatSize& scrollDelta) | 603 void CCLayerImpl::setScrollDelta(const FloatSize& scrollDelta) |
602 { | 604 { |
603 if (m_scrollDelta == scrollDelta) | 605 if (m_scrollDelta == scrollDelta) |
604 return; | 606 return; |
605 | 607 |
606 m_scrollDelta = scrollDelta; | 608 m_scrollDelta = scrollDelta; |
607 noteLayerPropertyChangedForSubtree(); | 609 noteLayerPropertyChangedForSubtree(); |
608 } | 610 } |
609 | 611 |
610 void CCLayerImpl::setPageScaleDelta(float pageScaleDelta) | 612 void CCLayerImpl::setImplTransform(const WebKit::WebTransformationMatrix& transf
orm) |
611 { | 613 { |
612 if (m_pageScaleDelta == pageScaleDelta) | 614 if (m_implTransform == transform) |
613 return; | 615 return; |
614 | 616 |
615 m_pageScaleDelta = pageScaleDelta; | 617 m_implTransform = transform; |
616 noteLayerPropertyChangedForSubtree(); | 618 noteLayerPropertyChangedForSubtree(); |
617 } | 619 } |
618 | 620 |
619 void CCLayerImpl::setDoubleSided(bool doubleSided) | 621 void CCLayerImpl::setDoubleSided(bool doubleSided) |
620 { | 622 { |
621 if (m_doubleSided == doubleSided) | 623 if (m_doubleSided == doubleSided) |
622 return; | 624 return; |
623 | 625 |
624 m_doubleSided = doubleSided; | 626 m_doubleSided = doubleSided; |
625 noteLayerPropertyChangedForSubtree(); | 627 noteLayerPropertyChangedForSubtree(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 if (!m_scrollbarAnimationController) | 670 if (!m_scrollbarAnimationController) |
669 m_scrollbarAnimationController = CCScrollbarAnimationController::create(
this); | 671 m_scrollbarAnimationController = CCScrollbarAnimationController::create(
this); |
670 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); | 672 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); |
671 m_scrollbarAnimationController->updateScrollOffset(this); | 673 m_scrollbarAnimationController->updateScrollOffset(this); |
672 } | 674 } |
673 | 675 |
674 } | 676 } |
675 | 677 |
676 | 678 |
677 #endif // USE(ACCELERATED_COMPOSITING) | 679 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |