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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 IntRect contentRect(IntPoint(), contentBounds()); | 151 IntRect contentRect(IntPoint(), contentBounds()); |
153 quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect,
debugBorderColor(), debugBorderWidth()), appendQuadsData); | 152 quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect,
debugBorderColor(), debugBorderWidth()), appendQuadsData); |
154 } | 153 } |
155 | 154 |
156 CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const | 155 CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const |
157 { | 156 { |
158 ASSERT_NOT_REACHED(); | 157 ASSERT_NOT_REACHED(); |
159 return 0; | 158 return 0; |
160 } | 159 } |
161 | 160 |
162 void CCLayerImpl::scrollBy(const FloatSize& scroll) | 161 FloatSize CCLayerImpl::scrollBy(const FloatSize& scroll) |
163 { | 162 { |
164 IntSize minDelta = -toSize(m_scrollPosition); | 163 IntSize minDelta = -toSize(m_scrollPosition); |
165 IntSize maxDelta = m_maxScrollPosition - toSize(m_scrollPosition); | 164 IntSize maxDelta = m_maxScrollPosition - toSize(m_scrollPosition); |
166 // Clamp newDelta so that position + delta stays within scroll bounds. | 165 // Clamp newDelta so that position + delta stays within scroll bounds. |
167 FloatSize newDelta = (m_scrollDelta + scroll).expandedTo(minDelta).shrunkTo(
maxDelta); | 166 FloatSize newDelta = (m_scrollDelta + scroll).expandedTo(minDelta).shrunkTo(
maxDelta); |
| 167 FloatSize unscrolled = m_scrollDelta + scroll - newDelta; |
168 | 168 |
169 if (m_scrollDelta == newDelta) | 169 if (m_scrollDelta == newDelta) |
170 return; | 170 return unscrolled; |
171 | 171 |
172 m_scrollDelta = newDelta; | 172 m_scrollDelta = newDelta; |
173 if (m_scrollbarAnimationController) | 173 if (m_scrollbarAnimationController) |
174 m_scrollbarAnimationController->updateScrollOffset(this); | 174 m_scrollbarAnimationController->updateScrollOffset(this); |
175 noteLayerPropertyChangedForSubtree(); | 175 noteLayerPropertyChangedForSubtree(); |
| 176 |
| 177 return unscrolled; |
176 } | 178 } |
177 | 179 |
178 CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& viewpo
rtPoint, CCInputHandlerClient::ScrollInputType type) const | 180 CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& viewpo
rtPoint, CCInputHandlerClient::ScrollInputType type) const |
179 { | 181 { |
180 if (shouldScrollOnMainThread()) { | 182 if (shouldScrollOnMainThread()) { |
181 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed shouldScrollOnMainThr
ead"); | 183 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed shouldScrollOnMainThr
ead"); |
182 return CCInputHandlerClient::ScrollOnMainThread; | 184 return CCInputHandlerClient::ScrollOnMainThread; |
183 } | 185 } |
184 | 186 |
185 if (!screenSpaceTransform().isInvertible()) { | 187 if (!screenSpaceTransform().isInvertible()) { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 | 578 |
577 void CCLayerImpl::setScrollDelta(const FloatSize& scrollDelta) | 579 void CCLayerImpl::setScrollDelta(const FloatSize& scrollDelta) |
578 { | 580 { |
579 if (m_scrollDelta == scrollDelta) | 581 if (m_scrollDelta == scrollDelta) |
580 return; | 582 return; |
581 | 583 |
582 m_scrollDelta = scrollDelta; | 584 m_scrollDelta = scrollDelta; |
583 noteLayerPropertyChangedForSubtree(); | 585 noteLayerPropertyChangedForSubtree(); |
584 } | 586 } |
585 | 587 |
586 void CCLayerImpl::setPageScaleDelta(float pageScaleDelta) | 588 void CCLayerImpl::setImplTransform(const WebKit::WebTransformationMatrix& transf
orm) |
587 { | 589 { |
588 if (m_pageScaleDelta == pageScaleDelta) | 590 if (m_implTransform == transform) |
589 return; | 591 return; |
590 | 592 |
591 m_pageScaleDelta = pageScaleDelta; | 593 m_implTransform = transform; |
592 noteLayerPropertyChangedForSubtree(); | 594 noteLayerPropertyChangedForSubtree(); |
593 } | 595 } |
594 | 596 |
595 void CCLayerImpl::setDoubleSided(bool doubleSided) | 597 void CCLayerImpl::setDoubleSided(bool doubleSided) |
596 { | 598 { |
597 if (m_doubleSided == doubleSided) | 599 if (m_doubleSided == doubleSided) |
598 return; | 600 return; |
599 | 601 |
600 m_doubleSided = doubleSided; | 602 m_doubleSided = doubleSided; |
601 noteLayerPropertyChangedForSubtree(); | 603 noteLayerPropertyChangedForSubtree(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 if (!m_scrollbarAnimationController) | 646 if (!m_scrollbarAnimationController) |
645 m_scrollbarAnimationController = CCScrollbarAnimationController::create(
this); | 647 m_scrollbarAnimationController = CCScrollbarAnimationController::create(
this); |
646 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); | 648 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); |
647 m_scrollbarAnimationController->updateScrollOffset(this); | 649 m_scrollbarAnimationController->updateScrollOffset(this); |
648 } | 650 } |
649 | 651 |
650 } | 652 } |
651 | 653 |
652 | 654 |
653 #endif // USE(ACCELERATED_COMPOSITING) | 655 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |