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_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) | 50 , m_pageScaleDelta(1) |
| 51 , m_pageScaleFactor(1) |
51 , m_renderTarget(0) | 52 , m_renderTarget(0) |
52 , m_drawDepth(0) | 53 , m_drawDepth(0) |
53 , m_drawOpacity(0) | 54 , m_drawOpacity(0) |
54 , m_drawOpacityIsAnimating(false) | 55 , m_drawOpacityIsAnimating(false) |
55 , m_debugBorderColor(0) | 56 , m_debugBorderColor(0) |
56 , m_debugBorderWidth(0) | 57 , m_debugBorderWidth(0) |
57 , m_drawTransformIsAnimating(false) | 58 , m_drawTransformIsAnimating(false) |
58 , m_screenSpaceTransformIsAnimating(false) | 59 , m_screenSpaceTransformIsAnimating(false) |
59 #ifndef NDEBUG | 60 #ifndef NDEBUG |
60 , m_betweenWillDrawAndDidDraw(false) | 61 , m_betweenWillDrawAndDidDraw(false) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 IntRect contentRect(IntPoint(), contentBounds()); | 153 IntRect contentRect(IntPoint(), contentBounds()); |
153 quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect,
debugBorderColor(), debugBorderWidth()), appendQuadsData); | 154 quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect,
debugBorderColor(), debugBorderWidth()), appendQuadsData); |
154 } | 155 } |
155 | 156 |
156 CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const | 157 CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const |
157 { | 158 { |
158 ASSERT_NOT_REACHED(); | 159 ASSERT_NOT_REACHED(); |
159 return 0; | 160 return 0; |
160 } | 161 } |
161 | 162 |
162 void CCLayerImpl::scrollBy(const FloatSize& scroll) | 163 FloatSize CCLayerImpl::scrollBy(const FloatSize& scroll) |
163 { | 164 { |
164 IntSize minDelta = -toSize(m_scrollPosition); | 165 IntSize minDelta = -toSize(m_scrollPosition); |
165 IntSize maxDelta = m_maxScrollPosition - toSize(m_scrollPosition); | 166 IntSize maxDelta = m_maxScrollPosition - toSize(m_scrollPosition); |
166 // Clamp newDelta so that position + delta stays within scroll bounds. | 167 // Clamp newDelta so that position + delta stays within scroll bounds. |
167 FloatSize newDelta = (m_scrollDelta + scroll).expandedTo(minDelta).shrunkTo(
maxDelta); | 168 FloatSize newDelta = (m_scrollDelta + scroll).expandedTo(minDelta).shrunkTo(
maxDelta); |
| 169 FloatSize unscrolled = m_scrollDelta + scroll - newDelta; |
168 | 170 |
169 if (m_scrollDelta == newDelta) | 171 if (m_scrollDelta == newDelta) |
170 return; | 172 return unscrolled; |
171 | 173 |
172 m_scrollDelta = newDelta; | 174 m_scrollDelta = newDelta; |
173 if (m_scrollbarAnimationController) | 175 if (m_scrollbarAnimationController) |
174 m_scrollbarAnimationController->updateScrollOffset(this); | 176 m_scrollbarAnimationController->updateScrollOffset(this); |
175 noteLayerPropertyChangedForSubtree(); | 177 noteLayerPropertyChangedForSubtree(); |
| 178 |
| 179 return unscrolled; |
176 } | 180 } |
177 | 181 |
178 CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& viewpo
rtPoint, CCInputHandlerClient::ScrollInputType type) const | 182 CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& viewpo
rtPoint, CCInputHandlerClient::ScrollInputType type) const |
179 { | 183 { |
180 if (shouldScrollOnMainThread()) { | 184 if (shouldScrollOnMainThread()) { |
181 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed shouldScrollOnMainThr
ead"); | 185 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed shouldScrollOnMainThr
ead"); |
182 return CCInputHandlerClient::ScrollOnMainThread; | 186 return CCInputHandlerClient::ScrollOnMainThread; |
183 } | 187 } |
184 | 188 |
185 if (!screenSpaceTransform().isInvertible()) { | 189 if (!screenSpaceTransform().isInvertible()) { |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 | 555 |
552 void CCLayerImpl::setScrollDelta(const FloatSize& scrollDelta) | 556 void CCLayerImpl::setScrollDelta(const FloatSize& scrollDelta) |
553 { | 557 { |
554 if (m_scrollDelta == scrollDelta) | 558 if (m_scrollDelta == scrollDelta) |
555 return; | 559 return; |
556 | 560 |
557 m_scrollDelta = scrollDelta; | 561 m_scrollDelta = scrollDelta; |
558 noteLayerPropertyChangedForSubtree(); | 562 noteLayerPropertyChangedForSubtree(); |
559 } | 563 } |
560 | 564 |
| 565 void CCLayerImpl::setLocalOffset(const FloatSize& offset) |
| 566 { |
| 567 if (m_localOffset == offset) |
| 568 return; |
| 569 |
| 570 m_localOffset = offset; |
| 571 noteLayerPropertyChangedForSubtree(); |
| 572 } |
| 573 |
561 void CCLayerImpl::setPageScaleDelta(float pageScaleDelta) | 574 void CCLayerImpl::setPageScaleDelta(float pageScaleDelta) |
562 { | 575 { |
563 if (m_pageScaleDelta == pageScaleDelta) | 576 if (m_pageScaleDelta == pageScaleDelta) |
564 return; | 577 return; |
565 | 578 |
566 m_pageScaleDelta = pageScaleDelta; | 579 m_pageScaleDelta = pageScaleDelta; |
567 noteLayerPropertyChangedForSubtree(); | 580 noteLayerPropertyChangedForSubtree(); |
568 } | 581 } |
569 | 582 |
570 void CCLayerImpl::setDoubleSided(bool doubleSided) | 583 void CCLayerImpl::setDoubleSided(bool doubleSided) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 if (!m_scrollbarAnimationController) | 632 if (!m_scrollbarAnimationController) |
620 m_scrollbarAnimationController = CCScrollbarAnimationController::create(
this); | 633 m_scrollbarAnimationController = CCScrollbarAnimationController::create(
this); |
621 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); | 634 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); |
622 m_scrollbarAnimationController->updateScrollOffset(this); | 635 m_scrollbarAnimationController->updateScrollOffset(this); |
623 } | 636 } |
624 | 637 |
625 } | 638 } |
626 | 639 |
627 | 640 |
628 #endif // USE(ACCELERATED_COMPOSITING) | 641 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |