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